RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: benmgreene
As some have noted,
yield(:title) || "Default"
no longer works in Rails 3. I recommend adding this method to a Helper:
def yield_or_default(section, default = "") content_for?(section) ? yield(section) : default end
and then calling
yield_or_default(:title, "Default")
Thanks for the great work, Ryan. --Ben
As some have noted,
yield(:title) || "Default"
no longer works in Rails 3. I recommend adding this method to a Helper:
def yield_or_default(section, default = "")
content_for?(section) ? yield(section) : default
end
and then calling
yield_or_default(:title, "Default")
Thanks for the great work, Ryan.
--Ben