RailsCasts Pro episodes are now free!

Learn more or hide this

Ben M Greene's Profile

GitHub User: benmgreene

Comments by Ben M Greene


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

and then calling

yield_or_default(:title, "Default")

Thanks for the great work, Ryan.