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!