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
|
||||
|
||||
def _assign_attribute(k, v)
|
||||
if respond_to?("#{k}=")
|
||||
public_send("#{k}=", v)
|
||||
setter = "#{k}="
|
||||
if respond_to?(setter)
|
||||
public_send(setter, v)
|
||||
else
|
||||
raise UnknownAttributeError.new(self, k)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue