wrong number of arguments (0 for 1) error.... Help!!!

Ryan Bigg wrote:

And finally, what version of Rails? ----- Ryan Bigg Freelancer http://frozenplague.net

I am using 2.0.2 with mysql database

Cypray

I have no clue. Author.find_by_name should be working when it
(apparently) is not. Something is broken.

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?

Cypray

It's supported. It's the syntax I showed you before:

Author.find_by_name("Blah").books, will get you all the books by that
author.

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