On Fri, Oct 2, 2009 at 12:27 PM, Juan Kinunt
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> Hi,
>
> I would like which is the best way to implement this:
> I have an application with invoices, lines, accouts, etc... lots of
> models. Each element of a model belongs to a different user so when a
> user is logged he will see only his elements. I can implement this
> adding in all the find methods the condition :user_id =>
> params[:user_id].
>
> But, is there any other way that automatically adds this condition to
> all the queries if a user is logged in?
> --
Have you defined relationships between those models?
--
Leonardo Mateo.
There''s no place like ~