ah, excellent yea your new way is definitely better. I'd like to keep
the delete in there so i can remove records if absolutely necessary
for now.

On Nov 4, 5:48 pm, Jeremy Evans <[email protected]> wrote:
> On Nov 4, 2:25 pm, Tal <[email protected]> wrote:
>
> > I was wanting to have destroy set a state rather then remove the row
> > from the db. Is there any reason this wouldn't be a good way to go
> > about it?
>
> >   def destroy
> >     before_destroy
> >     update(:state => 'removed')
> >     after_destroy
> >   end
> >   def_dataset_method :destroy
>
> If you don't want to allow deleting records at all, I'd override
> delete instead:
>
>  def delete
>    update(:state => 'removed')
>    self
>  end
>
> If you want delete to delete but destroy not to:
>
>  def _destroy
>    return save_failure(:destroy) if before_destroy == false
>    update(:state => 'removed')
>    after_destroy
>    self
>  end
>
> Your way isn't bad, but it doesn't honor the object's use_transactions
> setting, doesn't follow the convention that a before_hook returning
> false cancels the action, and doesn't return the object.
>
> Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to