On Jueves, 17 de Diciembre de 2009 22:33:41 Chris Drappier escribió:
> Hi All,
>
> I have several controllers that need a soft delete because the records in
> those tables are versioned. I've overwritten do_destroy in such a way that
> allows me to this. If I define the method directly in the controller, it is
> used when that action is called, but if I define it in the application
> controller, it continues to use the default. I also tried putting it in a
> module and including the module directly in the controller.  Any idea where
> I can put this to make it generally available?

Try to include the module in ActiveScaffold::Actions::Delete module. You have 
to include in the controller after active_scaffold is loaded, if you include it 
directly in the controller, after active_scaffold block, it should work too.

>
>
> thx
>
> -C
>
> p.s. shouldn't really matter, but here's the method I've written for
> reference. the logger in here is just so that I could verify whether or not
> it was being used.
>
> def do_destroy
>         destroy_find_record
>         begin
>
>       3.times { logger.info "X" * 40 }
>             @record.destroyed_at = Time.now
>             @record.destroyed_by = @session_user
>             self.successful = @record.save!
>         rescue
>             flash[:warning] = as_(:cant_destroy_record, :record =>
> @record.to_label)
>             self.successful = false
>         end
>     end
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

--

You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.


Reply via email to