Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ForbiddenAttributesError not raising for params with Array of hashes #159

Closed
sumisha-sourcebits opened this Issue · 0 comments

1 participant

@sumisha-sourcebits

If your parameter is an array of hashes and expecting to create multiple objects by looping the array, it creates the object successfully without raising ForbiddenAttributesError.

Assume the parameter as below:

params[:users] = [{:name => "test", :email => "test@gmail.com"}, {:name => "test1", :email => "test1@gmail.com"}]

Controller code where params[:users] being looped and trying to create a user object one by one.

params[:users].each do |user_params|
  user = User.new(user_params)
  user.save
end
@fxn fxn closed this in 62c0efb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.