-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I would say, that this is not a bug, but quite an unobvious behaviour:
>> City.new.country_id = Country.new.id
"50bcc9c75b9e058d6a000004"
>> City.new.send(:country_id=, Country.new.id)
false
>> City.new.send(:population=, 5)
nil
>> City.new.population = 5
5
And there is the same problem with calling super inside a redefinition of an attribute setter field.
There was not such a problem with Mongoid 2.
I think that the most obvious behaviour for a method with = is to have the parameter as the return value, so that it works the same independently of the way it was called.