On Oct 26, 1:37 pm, "Xavier Noria" <[EMAIL PROTECTED]> wrote:
> On Sun, Oct 26, 2008 at 10:21 AM, Fernando Perez
>
> <[EMAIL PROTECTED]> wrote:
> > :joins => ['LEFT OUTER JOIN orders ON (items.order_id = orders.id AND
> > orders.user_id = ?', params[:id]]
>
> Placeholders are not supported there indeed.
>
> You cannot work with regular AR association API calls right? For example:
>
> # untested
> user = User.find(params[:id])
> items = user.orders.map(&:items).flatten.uniq
>
> or say:
>
> # untested
> items = Item.all(
> :conditions => {'users.id' => params[:id]},
> :joins => {:order => :user}
> )
>
> If not, you can still extract an integer from params[:id] and safely
> interpolate. That's easy with Integer() or #to_i.
>
and more generally the connection object's quote method (and variants)
are useful. See also the sanitize_sql method.
Fred
> -- fxn
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---