Skip to content
This repository was archived by the owner on Aug 17, 2017. It is now read-only.

Conversation

route
Copy link

@route route commented Mar 1, 2013

For Rails 4 attr_accessible and attr_protected were extracted, so it's not problem to set these attributes with strong_parameters but for rails 3 it AR protects default attributes and it's impossible to set them even if they passed by strong_parameters

1.9.3p385 :001 > raw_parameters = { :id => 1, :type => 'MediaFile' }
 => {:id=>1, :type=>"MediaFile"} 
1.9.3p385 :002 > parameters = ActionController::Parameters.new(raw_parameters)
 => {"id"=>1, "type"=>"MediaFile"} 
1.9.3p385 :003 > gift = Gift.new(parameters.permit(:id, :type))
ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes: id, type

@route
Copy link
Author

route commented Mar 1, 2013

Oh and seems like it's related to #81

@atipugin
Copy link

Would be nice to see it in master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants