On Dec 10, 5:36 am, Jay Mark <[EMAIL PROTECTED]> wrote:
> Ryan Bigg wrote:
> > I have no clue. Author.find_by_name should be working when it
> > (apparently) is not. Something is broken.
> > -----
> > Ryan Bigg
> > Freelancer
> >http://frozenplague.net
>
> I think so too. Thanks for your help.
> Why is it so hard to find the correct syntax for doing a subselect in
> Rails?
> Is subselect not supported in Rails?
>

For the sake of argument you can do

@books = Books.find_by_sql ["SELECT * FROM books WHERE title IN
(SELECT
title FROM authors WHERE name = ?)", params[:author][:name]]

But really whenever you use find_by_sql you should give yourself  a
long hard look in the mirror. There's almost always a better way.

Fred
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to