undefined method `full_title' [duplicate]

情到浓时终转凉″ 提交于 2019-12-06 04:46:09

Any method accessible to the views directly has to go to the helper.

Since you are trying to access this method in your layouts, put your code in the application_helper.rb file.

All helpers are modules only.

If you don't have the file, create one in app/helpers

module ApplicationHelper
 def full_title(page_title)
  base_title = "Ruby on Rails Tutorial Sample App"
  if page_title.empty?
    base_title
  else
    "#{base_title} | #{page_title}"
  end
 end
end

Then, include ApplicationHelper in application_controller.rb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!