I have a layout and partials that are working fine. The problem is different models all have the same title. If would be nice if I can customize the title for each model.
This is my layout:
<html>
<head>
<title><%= content_for :title %></title>
</head>
<body>
<%= render 'header' %>
<%= render "sidebar" %>
<%= render "content" %>
<%= render template: "layouts/footer" %>
</body>
</html>
This is my controller I tried making work based on undefined method `content_for' in presenter rails:
class ViewerController < ApplicationController
def index
helpers.content_for :title, "Viewer"
#helpers.content_for (:title) "Viewer" #doesn't work
end
def helpers
ActionController::Base.helpers
end
end
I tried changing the layout to <%= helpers.content_for :title %> but it did not work. I also tried changing the controller to helpers.content_for (:title) "Viewer" and elpers.content_for (:title) || "Viewer" based on other posts but they fail.
If this approach does not work then I am open to another.