Setting page titles as attribute values with Rails -


i'm wondering if knows how set page's title attribute.

was thinking along lines of:

<% content_for :title, "museum | '@gallery.name'" %> 

but cant figure out wrap @gallery.name in, if right approach.

it's simple question, seem stumped!

maybe?

<% content_for :title %> (@gallery && @gallery.name) || 'museum' <% end %>

of course yield :title somwewhere required

credits @clark

if text should museum | foobar if @gallery name exists instead of (@gallery && @gallery.name) || 'museum' should "museum | #{@gallery && @gallery.name} (in case @gallery guaranteed defined simplier "museum | #{@gallery.name}" (remember use double " not ').


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -