
Can't override attribute setters with module methods in DataMapper 0.10
Reported by Anna Gabutero | December 2nd, 2009 @ 09:29 AM
Consider the following code:
require 'dm-core'
module MyModule
def name=(n)
attribute_set(:name, n.downcase)
end
end
class A
include DataMapper::Resource
property :id, Serial
property :name, String
def name=(n)
attribute_set(:name, n.downcase)
end
end
class B
include DataMapper::Resource
include MyModule
property :id, Serial
property :name, String
end
I expect that using name= in an instance of A or B will set the name attribute to the lowercase version of whatever I passed it.
This worked as expected in DataMapper 0.9.11. However only instances of class A behave as expected in DataMapper 0.10.1.
Comments and changes to this ticket
-
Martin Gamsjaeger (snusnu) October 29th, 2010 @ 04:58 PM
- State changed from new to resolved
- Assigned user set to Dirkjan Bussink
- Milestone order changed from 0 to 0
I believe this is fixed in http://github.com/datamapper/dm-core/commit/80a40b03b978d8d7d11d18a...
I might be wrong tho. Someone please doublecheck?
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »