Can you just override the default setter that active records creates in
your model and throw an execption if it gets called?
What’s an Intel chip doing in a Mac? A whole lor more that it’s ever
done in a PC.
My Digital Life - http://scottwalter.com/blog
Pro:Blog - http://scottwalter.com/problog
Snippets - http://snippets.scottwalter.com
----- Original Message ----
From: Oleg F. email@example.com
Sent: Monday, May 8, 2006 12:53:13 AM
Subject: [Rails] how to make field in model immutable after create
I want to have login field in User model which is set only once (on
create), and then it should fail validation if the value is changed.
How can I do this? I dig around for validation and tried
errors.add(:login, “is immutable. You can’t change it”)
in model, but somewhat it doesn’t work. Any hints on how can I make
field immutable after create?