Skip to main content

RuntimeError (can't modify frozen String)

Rails • Asked by Joe Guerra

got this runtime error on heroku, it had been working fine...

I traced it down to this

add_breadcrumb 'category / ' << @title, categories_path

in my category controller (I've commented it out for now). Is there an alternative way to concat this so it doesn't cause an error?

yes, i'm using that gem. Just stopped liking the way I concatenated the breadcrumb.

What should add_breadcrumb 'category / ' << @title, categories_path output?

it should add / category / + category title to my breadcrumb.

How about something like this?

add_breadcrumb "category / #{@title}", categories_path

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 20,000+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.