Nat,
I think with_scope() is what you''re looking for.
--
Zack Chandler
http://depixelate.com
On 3/16/07, Nathaniel
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> Dear all,
>
> Is it possible to declare Active Record ''find'' conditions
and have these
> '':conditions'' apply to numerous find queries on a table
without having
> to re-declare the conditions on every line where you have a find?
>
> As an example, suppose you have a table of records of users and
> throughout a controller you only want to query records of people who are
> not ''administrators''
>
> A few months ago, when I read through a draft PDF of Agile Web
> Development with Rails 2nd ed, I seem to remember reading something like
> this...I think it even said you could declare a condition in an
''around
> filter'' and have it apply to all ''find'' calls
within filtered actions.
> But for the life of me, if it was there I can''t find it in the
final
> version.
>
> Thanks, Nat
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---