Hi, I'm sending this message again due to the migrationof the list..
I'm trying to build a query that looks like this:
@book_pages, @books = paginate(:books,
:per_page => 20,
:conditions => ['book.author.name like ?', '%jim%],
:order_by => @sort_order)
I want to basically list out all the books by authors with names like 'jim' - prefer to have this paginated so that I can use my basic paginated list view. However, this throws up an exception:
Mysql::Error: Unknown table 'books' in where clause: SELECT count(*) AS count_all FROM books WHERE (author.name like '%ha%')
authors have_many books
book belongs_to author
I'm sorry I seem very confused about how to do the query. I'd appreciate help!
What do you think I'm doing wrong?