mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
enhance active model assignment
This commit is contained in:
parent
326914dd3a
commit
285cba022c
1 changed files with 3 additions and 2 deletions
|
@ -42,8 +42,9 @@ module ActiveModel
|
||||||
end
|
end
|
||||||
|
|
||||||
def _assign_attribute(k, v)
|
def _assign_attribute(k, v)
|
||||||
if respond_to?("#{k}=")
|
setter = "#{k}="
|
||||||
public_send("#{k}=", v)
|
if respond_to?(setter)
|
||||||
|
public_send(setter, v)
|
||||||
else
|
else
|
||||||
raise UnknownAttributeError.new(self, k)
|
raise UnknownAttributeError.new(self, k)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue