On May 22, 9:09 am, Denis Kokin <[email protected]> wrote:
> I want to have two destroy methods for my model.
>
> First method must be a "classic" destroy method — find a record and
> destroy it. "Delete Forever" link in the view.
> Second method must find a record and mark it as deleted (or as moved
> to trash). "Move to Trash" link in the view.
>
> How can I do this? Should I just use model.destroy for the first case
> and write custom method for the second? In this case how can I make a
> "Move to Trash" link for the second method in the view inaccessible
> for spiders?
>
I would go this way. Whenever you display records to the end user
you'll need to check for that flag ( named_scope and/or default_scope
may be useful here).

Fred
> Or can I pass an argument for destroy method from view and depending
> on that argument do a "classic" destroy or just mark the record as
> deleted?
>
> Or even something else?
--~--~---------~--~----~------------~-------~--~----~
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