1) in the controller I define the @info = Info.find_by slug: params[:id] variable @info = Info.find_by slug: params[:id]

2) In the helper I define two methods:

  def title_for_info if @info.present? @info.title else "Текст" end end def description_for_info # @info = Info.find_by slug: params[:id] if @info.present? @info.description else "Текст" end end 

3) I prescribe in the appropriate layout:

 %meta{:content => "#{description_for_info}",:name => "description"}/ %title= title_for_info 

There is a page with a list of links, when you click on any one you get the following: the title is always loaded correctly, but the description always goes down the "Text" branch. If on this initial page the link is copied and opened in a new tab (or stupidly refresh the page), then the description loads correctly. It also works correctly if it is stupid to output before the meta tag = @info.description

Why is this behavior observed and what to do about it?

Update In general, these are the features of Turbolinks , while I think how to do without gems.

    1 answer 1

    In my case it helped add to the links on the initial page :target => '_self'