Phlip
2007-Aug-22 15:25 UTC
ActiveRecord crashes on :include and :limit. is there a fix for ticket/6415?
Railsters: Our design is just one refactor away from attaining Nirvana (and deleting a _lot_ of code!). Only this bug stands between us and enlightenment: http://dev.rubyonrails.org/ticket/6415 Here''s a synopsis: Frog.find( :all, :include => { :species => [''clade''] }, :conditions => [''clade_id in (?)'', 1], :limit => 12 ) That produces this: ActiveRecord::StatementInvalid: Mysql::Error: Unknown column ''clade_id'' in ''where clause'': SELECT id FROM frogs WHERE (clade_id in (1)) LIMIT 12 That SELECT is clearly missing most of its details, including niceties like frogs.* for the result columns. Without the :limit, it works fine (so I don''t think that :offset is implicated, like the ticket says). I''m going into ActiveRecord to monkey patch this. Has anyone tried yet? -- Phlip http://www.oreilly.com/catalog/9780596510657/ ^ assert_xpath http://tinyurl.com/yrc77g <-- assert_latest Model --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2007-Aug-22 15:47 UTC
Re: ActiveRecord crashes on :include and :limit. is there a fix for ticket/6415?
Hi -- On Wed, 22 Aug 2007, Phlip wrote:> > Railsters: > > Our design is just one refactor away from attaining Nirvana (and > deleting a _lot_ of code!). Only this bug stands between us and > enlightenment: > > http://dev.rubyonrails.org/ticket/6415 > > Here''s a synopsis: > > Frog.find( :all, :include => { :species => [''clade''] }, > :conditions => [''clade_id in (?)'', 1], > :limit => 12 ) > > That produces this: > > ActiveRecord::StatementInvalid: Mysql::Error: Unknown column > ''clade_id'' in ''where clause'': SELECT id FROM frogs WHERE (clade_id in > (1)) LIMIT 12Does it work if you change clade_id to species.clade_id? David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com) --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Phlip
2007-Aug-22 16:15 UTC
Re: ActiveRecord crashes on :include and :limit. is there a fix for ticket/6415?
dblack wrote:> > Frog.find( :all, :include => { :species => [''clade''] }, > > :conditions => [''clade_id in (?)'', 1], > > :limit => 12 )> Does it work if you change clade_id to species.clade_id?That was it! Thanks! I didn''t think that would work because the SELECT statement was so totally broken. That didn''t indicate pilot error to me. (Also it''s habtm, so it''s clades_species.clade_id...) And now a _lot_ of code that''s doing a heckuva job is about to get downsized. with_scope rules! BTW we have both of these... (-;> * Books: > RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) > RUBY FOR RAILS (http://www.manning.com/black) > * Ruby/Rails training > & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)-- Phlip http://www.oreilly.com/catalog/9780596510657/ ^ assert_xpath http://tinyurl.com/yrc77g <-- assert_latest Model --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---