Forum: Ruby on Rails Unassign Object Attributes

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
3ff4f912c1aebaf3f73622cf4847ddc4?d=identicon&s=25 Sven S. (rubix)
on 2007-01-14 10:33
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
This topic is locked and can not be replied to.