> Hi Andrew
> The use of super is the correct usage. That invokes the accessor, and
> thus the appropriate dirtiness tracking mechanisms, which in turn
> ensure the changed property is persisted to the datastore. The
> example in the docs is currently incorrect, though that syntax might
> work at some point in the future (if/when improved dirtiness tracking
> is added). For now, use super. Or "self[:property_name] =
> 'something'"
> Regards
> Jon
> On 29 March 2011 12:15, andrew8088 <andrew8...@gmail.com> wrote:
> > I'm having an issue with overriding accessors; here's my model:
> > class User
> > include DataMapper::Resource
> > property :id, Serial
> > property :username, String
> > def username= new_username
> > @usename = new_username.downcase
> > end
> > end
> > The problem is that, when using a custom accessor like I have here,
> > the field doesn't get set; it gets set to null. I've found that I can
> > do this:
> > def username= new_username
> > super new_username.downcase
> > end
> > And that works fine. Of course, not overriding the accessor works
> > too.
> > I copied the example from the documentation (http://rubydoc.info/
> > github/datamapper/dm-core/master/DataMapper/Property) and had the same
> > problem with it.
> > Has the syntax changed? Am I doing something wrong?
> > Thanks!
> > PS - if it matters, I'm using dm-core 1.1.0 in Ruby 1.9.2 on Snow
> > Leopard
> > --
> > You received this message because you are subscribed to the Google Groups "DataMapper" group.
> > To post to this group, send email to datamapper@googlegroups.com.
> > To unsubscribe from this group, send email to datamapper+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/datamapper?hl=en.