We have a Page model which acts_as_paranoid.
AAP modifies ActiveRecord finders to ignore any records marked as deleted unless the :with_deleted => true option is supplied.
We have a UI element which allows users to toggle whether or not to display deleted Pages, their current setting being stored in a session variable, session[:show_deleted].
What we would like is to automagically have :with_deleted => session [:show_deleted] appended to all calls to find, all, first, find_by_ etc.
That would be easy enough to do with an alias_method_chain but for the fact that session data is not available when the call is being made from a model.
I know accessing session data in a model is controversial, but can anyone suggest a workaround? Or alternatively another approach to being able to easily switch between including/ignoring deleted records in all finder methods?
Thanks.