[Rails] updating user status
Hi
I have the models
User belongs_to user_status and
UserStatus
user_statuses is a master table having values
id name
1 Pending
2 Approved
3 Deleted
Now when ever a user is created for the first time his user_status_id
is 1 (ie pending). Administrator when click on Approve button status
changes to "Approved". My question is implementing this. Is it right to
update like
In user controller update action
user = User.find(params[:id])
user.update_attributes(:user_status_id => 2)
Rather than hard coding user_status_id = 2, is there any other
approach?
Thanks in advance
Tom
--
Posted via http://www.ruby-forum.com/.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home