AS with acts_as_paranoid

23 views
Skip to first unread message

Rafael G.

unread,
Dec 20, 2007, 4:45:54 AM12/20/07
to actives...@googlegroups.com
Hi,

I'm using AS with acts_as_paranoid. Act_as_paranoid is used to do a
logical delete (don't delete really), it uses delete_at attribute to
mark registers as "deleted". If deleted_at attribute is not null is
"deleted" else will be showed in any query. If I want to show "deleted"
registers I must use Model.find_with_deleted, with Model.find show
register with deleted_at with nil value.

I override search form and added a checkbox for show "deleted"
register. Then when checkbox is checked, I want to use for search
find_with_deleted method. I debugged until active_scaffold/lib/finder.rb
file and modified find_page method, but I don't know if it's correct.
Does anyone have a better idea?

Regards

--
Rafael Garcia Ortega

rgo.vcf

Rafael G.

unread,
Dec 20, 2007, 5:02:58 AM12/20/07
to actives...@googlegroups.com
sorry! I found the solution in thread "How do I build a custom search in
AS".
Thanks Lance Ivy ;)


Rafael G. escribió:

rgo.vcf

Shreya Bhatia

unread,
Aug 25, 2011, 12:29:00 AM8/25/11
to actives...@googlegroups.com
Hi Rafael,

I want to include the soft-deleted records in my list of records.
Could you tell me how did you do this?

Thanks,
Shreya

Sergio Cambra .:: entreCables S.L. ::.

unread,
Aug 25, 2011, 5:48:56 AM8/25/11
to actives...@googlegroups.com

I don't remember how acts_as_paranoid works. You must override destroy method
in the model if plugin doesn't do it. Also you must set
conditions_for_collection to filter out deleted records in the controller, or
override beginning_of_chain to use a scope method, unless acts_as_paranoid set
a default_scope to filter out the records, in that case maybe you don't need
anymore.

--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) ser...@entrecables.com

Reply all
Reply to author
Forward
0 new messages