batch_translations icon indicating copy to clipboard operation
batch_translations copied to clipboard

WARNING: Can't mass-assign protected attributes:

Open fad opened this issue 13 years ago • 3 comments

I love the idea of this plugin to integrate with the default form. Sadly I can't get it to work.

I did as told in the readme. Had to change <% f.globalize_fields_for :es do |g| %> to <%= f.globalize_fields_for :es do |g| %> though.

But when I submit, I get "WARNING: Can't mass-assign protected attributes: name" in my case and the translation is not set. I have "accepts_nested_attributes_for :translations" in my model file and tried around with attr_accessible, but to no avail.

Any ideas? (Rails is 3.0.3)

fad avatar Jul 20 '11 17:07 fad

Hmm, I've developed this plugin long time ago, but I tested it and it works for me.

Try to add in your model attr_accessible :translations - I think that's the problem. Which version of globalize3 you use?

Regards!

fidel avatar Jul 21 '11 22:07 fidel

I added this to my gemfile for globalize: gem 'globalize3', :git => 'git://github.com/galetahub/globalize3.git' So I guess the current one. Rails: 3.0.4 Ruby: 1.8.7

Tried "attr_accessible :translations" before. Didn't work: Started POST "/admin/categories/1?locale=de" for 127.0.0.1 at Fri Jul 22 07:23:44 +0200 2011 Processing by CategoriesController#update as HTML Parameters: {"commit"=>"Update", "category"=>{"translations_attributes"=>{"1"=>{"name"=>"action", "id"=>"11", "locale"=>"es"}}, "name"=>"Action"}, "authenticity_token"=>"1QAI7xELVyFZ00gnls3K9rfiv2Hb1DHXWHg5iNGadII=", "utf8"=>"✓", "id"=>"1", "locale"=>"de"} Category Load (0.2ms) SELECT "categories".* FROM "categories" WHERE ("categories"."id" = 1) LIMIT 1 WARNING: Can't mass-assign protected attributes: translations_attributes, name

I will start a clean project later and try there and give you feedback.

fad avatar Jul 22 '11 05:07 fad

I am getting the same problem, so I opened a question at http://stackoverflow.com/questions/10139245/how-to-solve-the-cant-mass-assign-protected-attributes-translations-attribute.

Backoo avatar Apr 13 '12 10:04 Backoo