Technology and Software

Globalize3, unknown attribute: translations_attributes

Another easy one with the twist that I couldn’t google the error message, which basically never happens. Either it’s a nasty bug or I did some really dumb mistake. Chances are that… wait, which one are you betting on?

So, the error occurred inside the update_attributes of a controller’s update method. The problem is that it saves the data coming from a very big form with many nested models with many accepts_nested_attributes_for. Some of those models are translated with globalize3 and there are no hints about which one triggered the error. It looked hard to debug but hopefully I did something dumb, right?

My first thought was that I forgot to create the translation tables in some globalized model but no, there they are. My second thought was that I forgot to add either a call to translates or something like that. It turned out that I forgot  accepts_nested_attributes_for :translations in a couple of models.

Dumb indeed but there is a post to google for this error now!

Advertisements
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s