I have no clue. Author.find_by_name should be working when it
(apparently) is not. Something is broken.
Ryan B.
Freelancer
Ryan B.
Freelancer
Ryan B. wrote:
I have no clue. Author.find_by_name should be working when it
(apparently) is not. Something is broken.Ryan B.
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?
Cypray
It’s supported. It’s the syntax I showed you before:
Ryan B.
Freelancer
On Dec 10, 5:36 am, Jay M. [email protected] wrote:
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
Frederick C. wrote:
On Dec 10, 5:36�am, Jay M. [email protected] wrote:
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
Thanks a lot Fred. It works perfect now. Thanks for your help guys.
Cypray
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs