Unassign Object Attributes

Sven Schwyn
Sun, 14 Jan 2007 09:33:58 -0000

Hi there

I''m a little stuck with something probably quite trivial to more ror
savvy folks than me:

My user model has two columns password_salt and password_hash (following
to the ror cookbook) and a setter method password= that creates the hash
of a plain password and writes it to the above attributes. I haven''t
succeeded however to get this constellation to work along with the
scaffold edit code.

The question now is: Is there a way to unassign (remove) an attribute
from an object, something like "undef @user[:password]" which of
course
only works for methods and not for attributes.

And if so, the code would have to go into an observer class. Which leads
me to the bonus question: Is there a way to access helper modules and/or
params/session/flash/... from within an observer?

Any ideas?

Many thanks,  -sven

--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---