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''}) 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 10 May 2010 21:34, Nadal <node.js99-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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''})Don''t you need find(:all, :conditions....) or is that a rails 3 change? Colin> > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No. It is not a rails3 thing. It was just me being stupid. Can''t believe I missed that. Spent so much time on this. Thanks On May 10, 4:41 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 10 May 2010 21:34, Nadal <node.j...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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''}) > > Don''t you need find(:all, :conditions....) or is that a rails 3 change? > > Colin > > > > > > > > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, May 10, 2010 at 1:34 PM, Nadal <node.js99-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.