I am trying to add some instance variables in helpers like the following:
module ApplicationHelper
def title=(title)
@title = title
end
def title
@title
end
end
and when I assign title in views/pages/index.html.erb like the following:
<% title = 'Listing Pages' %>
and try to show it in the views/layouts/application.html.erb like the following:
<%= title %>
it is showing as '' and after some debugging, looks like @title is not being set.
Why are the instance variables added in the helpers not available in the views (templates)?
Thanks in advance.