On 10 Dec 2008, at 06:55, Priya Dharsini wrote:
>
> @books = Book.find(:all, :joins=>"books inner join authors as a on
> books.title=a.name", :conditions => ['name LIKE ? ',
> '%'+params[:author][:name]+'%'])
What out for sql injection there.
Fred
>
>
>
> try with the above code
>
> Jay Mark w
Jay Mark wrote:
> Priya Buvan wrote:
>> @books = Book.find(:all, :joins=>"books inner join authors as a on
>> books.title=a.name", :conditions => ['name LIKE ? ',
>> '%'+params[:author][:name]+'%'])
>>
>>
>> try with the above code
>
>
>
> I put the code in Authors Controller as it is, and
Priya Buvan wrote:
> @books = Book.find(:all, :joins=>"books inner join authors as a on
> books.title=a.name", :conditions => ['name LIKE ? ',
> '%'+params[:author][:name]+'%'])
>
>
> try with the above code
I put the code in Authors Controller as it is, and I get nil object
error.
Since I
@books = Book.find(:all, :joins=>"books inner join authors as a on
books.title=a.name", :conditions => ['name LIKE ? ',
'%'+params[:author][:name]+'%'])
try with the above code
Jay Mark wrote:
> I have to use subselect for this query.
> find_all_by_name and joins will not work.
> Please I nee
Hi,
Actually what's your requirement? If you tell your requirement
clearly then the solution can be found.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails
Jeff Cohen wrote:
> On Dec 9, 1:47�pm, Jay Mark <[EMAIL PROTECTED]> wrote:
>> Jeff Cohen wrote:
>> Thanks for all your help Jeff.
>> It is still not working.
>> The find_by_name, gives me this error:
>> "undefined method `find_by_name' for "
>
> Can you post the full details of the error mess
On Dec 9, 1:47 pm, Jay Mark <[EMAIL PROTECTED]> wrote:
> Jeff Cohen wrote:
> Thanks for all your help Jeff.
> It is still not working.
> The find_by_name, gives me this error:
> "undefined method `find_by_name' for "
Can you post the full details of the error message from your log file?
Also
Jeff Cohen wrote:
> On Dec 9, 11:52�am, Jay Mark <[EMAIL PROTECTED]> wrote:
>
>> where title is equal to the title returned by the inner query.
>> The strange thing here is, title has a unique entry in authors table,
>> but title has duplicate entries in the book table.
>>
>> So, the main point h
On Dec 9, 11:52 am, Jay Mark <[EMAIL PROTECTED]> wrote:
> Here is the table structure:
>
> Author has id, name, title, book_id and other columns
> Book has id, title, isbn, and other columns.
>
> They both have the title column. And, yes, authors has book_id as a
> foreign key
> for books.
> The
Jeff Cohen wrote:
> On Dec 9, 11:06�am, Jay Mark <[EMAIL PROTECTED]> wrote:
>> @books = Books.find_by_sql ["SELECT * FROM books WHERE title IN SELECT
>> title FROM authors WHERE name = ?", params[:author][:name]]
>>
>> One problem is where to put the () that will enclose the inner select.
>> Or ma
On Dec 9, 11:06 am, Jay Mark <[EMAIL PROTECTED]> wrote:
> I have to use subselect for this query.
> find_all_by_name and joins will not work.
> Please I need help with getting the correct syntax for doing subselect
> the rails way.
> The query works fine in mysql.
> I can't find the syntax in the
11 matches
Mail list logo