On Mon, May 10, 2010 at 1:34 PM, Nadal <[email protected]> wrote:

> I am using rails3 edge.
>
> class user < AR
>  has_many :books
> end
>
> Following statement is failing in console.
>
> User.first.books.find(:conditions => {:title => 'ror'})
>
>
Nadal, the above syntax is marked for deprecation in Rails 3.1.  Thus, I
would recommend using the newer
interfaces.  Thus, you can write the above by doing the following:

User.first.books.where( :title => 'ror' )

I would recommend taking a look at the following screen cast:

http://media.railscasts.com/videos/202_active_record_queries_in_rails_3.mov

Also, Pratik has an excellent post on the subject that you can find here:

http://m.onkey.org/2010/1/22/active-record-query-interface

Good luck,

-Conrad



>
> ActiveRecord::RecordNotFound: Couldn't find Book without an ID
>
> It is such a basic thing that I am sure can't fail.
>
> Is it working fine for others?
>
> Please test it with rails edge and not with beta3.
>
> Thanks
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 [email protected].
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