Skip to content
Extraits de code Groupes Projets
Valider dc124790 rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

Filter :id in User.build for now

Rails 4 seem to allow setting the id through supplied parameters
The controllers ported to strong_parameters should guard against
attacks over this vector, but I didn't want to remove the specs
that test this here
parent 659f0b96
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -355,7 +355,7 @@ class User < ActiveRecord::Base
###Helpers############
def self.build(opts = {})
u = User.new(opts.except(:person))
u = User.new(opts.except(:person, :id))
u.setup(opts)
u
end
......@@ -369,7 +369,7 @@ class User < ActiveRecord::Base
errors = self.errors
errors.delete :person
return if errors.size > 0
self.set_person(Person.new(opts[:person] || {} ))
self.set_person(Person.new((opts[:person] || {}).except(:id)))
self.generate_keys
self
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter