I'm working on a Rails 4 app that was previously upgraded from Rails 3. I haven't worked much Rails 3 before. I came across this something like this user.update_attributes({ attr => bulk_update_params[attr] }, :as => :admin)
. Rails 4 currently complains that update_attributes
only accepts 1 argument and not 2.
I tried merging the as: :admin
by doing user.update_attributes({ attr => bulk_update_params[attr] }).merge(as: :admin)
but then i get greeted with something like "as" is not a known attribute".
Not entirely sure but how do I deal with the as: admin
part? Is it safe to remove it entirely or there's a way to pass as: :admin
to the original user.update_attributes({ attr => bulk_update_params[attr] }, :as => :admin)
in Rails 4?
I think it has something to do with attr_accessible
and strong_params
just not sure how to work with it in Rails 4 now. Any ideas?
Aucun commentaire:
Enregistrer un commentaire