Hi,

  Maybe you could try acts_as_state_machine


On Mon, Jan 11, 2010 at 1:49 PM, Tom Mac <[email protected]> wrote:

> 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/.
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>
>
--
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 [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to