[Rails] Re: Overwriting default accessors

2009-10-12 Thread Joshua Partogi
On Oct 13, 2:24 am, Marnen Laibow-Koser wrote: > Then you want something like > > def status=(value) > new_value = do_something_to(value) > self[:status] = new_value # assuming this class is derived from AR > end > > The reason your attempt to do status = value didn't work is that it was > ju

[Rails] Re: Overwriting default accessors

2009-10-12 Thread Marnen Laibow-Koser
Joshua Partogi wrote: > Hi Marnen > > > On Oct 12, 3:04 pm, Marnen Laibow-Koser > wrote: >> > hoping that this accessors would be able to set or change the value of >> > :status. But the behaviours doesn't seems to be like that. >> >> It can be, but you'll have to do it slightly differently. I

[Rails] Re: Overwriting default accessors

2009-10-11 Thread Joshua Partogi
Hi Marnen On Oct 12, 3:04 pm, Marnen Laibow-Koser wrote: > Joshua Partogi wrote: > > On Oct 12, 10:31 am, Marnen Laibow-Koser > > wrote: > >> > end > > >> This won't quite work. But before I try to improve it...what are you > >> trying to do? Set status to P no matter the argument that the f

[Rails] Re: Overwriting default accessors

2009-10-11 Thread Marnen Laibow-Koser
Joshua Partogi wrote: > On Oct 12, 10:31 am, Marnen Laibow-Koser > wrote: >> > end >> >> This won't quite work. But before I try to improve it...what are you >> trying to do? Set status to P no matter the argument that the function >> is called with? >> > > Well there are more logic there actu

[Rails] Re: Overwriting default accessors

2009-10-11 Thread Joshua Partogi
On Oct 12, 10:31 am, Marnen Laibow-Koser wrote: > Joshua Partogi wrote: > > Hi all, > > > Coming from the Java & Hibernate world, I was confused when trying out > > this piece of line of code: > > class Task < ActiveRecord::Base > > def status=(status) > > status = 'P' > > write_attribu

[Rails] Re: Overwriting default accessors

2009-10-11 Thread Marnen Laibow-Koser
Joshua Partogi wrote: > Hi all, > > Coming from the Java & Hibernate world, I was confused when trying out > this piece of line of code: > class Task < ActiveRecord::Base > def status=(status) > status = 'P' > write_attribute(:status, status) > end > end This won't quite work. But b