cesium62
2006-Sep-20 04:19 UTC
rails bug: incorrect sql generated or no error checking performed
I wrote the following rails code in one of my models:
su = self.find(:first,
["scrape_type = ? and finished = 0", scrapetype],
:order=>"updated_at");
According to development.log, this generated the following SQL:
SELECT * FROM scrape_urls ORDER BY updated_at LIMIT 1
Note that the man page
http://rubyonrails.org/api/classes/ActiveRecord/Base.html contains an
example with the above format:
Company.find(:first, [
"id = :id AND name = :name AND division = :division AND
created_at> :accounting_date",
{ :id => 3, :name => "37signals", :division =>
"First",
:accounting_date => ''2005-01-01'' }
])
Bug #1: Since rails ignored the array that I supplied, Rails should
have generated an error.
Bug #2: The documentation is probably incorrect. I currently suspect
that the phrase ":condition=>" should appear before the open
bracket.
Bug #3: It''s too hard to figure out how to submit a bug report to
rails. Hope you guys find this and fix your code.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Mark Van Holstyn
2006-Sep-20 04:35 UTC
Re: rails bug: incorrect sql generated or no error checking performed
> > Bug #2: The documentation is probably incorrect. I currently suspect > that the phrase ":condition=>" should appear before the open bracket.This is the case. Bug #3: It''s too hard to figure out how to submit a bug report to> rails. Hope you guys find this and fix your code.To create a new ticket, visit http://dev.rubyonrails.org/newticket You must first login[http://dev.rubyonrails.org/login] or register[ http://dev.rubyonrails.org/register]. Mark -- Mark Van Holstyn mvette13-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://lotswholetime.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 -~----------~----~----~----~------~----~------~--~---