Try something like this:
Plan.where("user_id not in (#{[3,4,7].join(', ')})")
2013/2/25 tamouse mailing lists <[email protected]>
> On Sun, Feb 24, 2013 at 8:43 PM, Javier Quarite <[email protected]>
> wrote:
> >
> > Have you considered doing a sql query?
> >
> > my approach would be this
> >
> > query_array = []
> > [3,4,7].each do |value|
> > query_array << "user_id != #{value}"
> > end
> >
> > Plan.where("#{query_array}.join(" and ")")
> >
> > Also, the past week I found this gist from ryan
> > https://gist.github.com/ryanb/4974414
> >
> > I'm still analyzing it but it taught me a lot
> >
> > Javier
>
> If going the SQL route, easier might be:
>
> Plan.where("user_id not in (3,4,7)")
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.