Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Ben M Greene's Profile

GitHub User: benmgreene

Comments by Ben M Greene

Avatar

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