Joshua Partogi wrote: > Hi Marnen > > > On Oct 12, 3:04 pm, Marnen Laibow-Koser > <rails-mailing-l...@andreas-s.net> 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'll help >> you, but you're going to have to explain exactly what you want to have >> happen. > > The point is I want to set the value of the status before it is saved > to the database.
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 just calling the same method. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---