Have a working 1.2.6 application (OS X 10.4.11, Ruby 1.8.6), which I am now trying to run under 2.0.2 (via freeze). First snag I''ve run into that I can''t find any info on is that Rails is gagging on a simple .count statement like this: (Comment.count ["article_id = ?", (session[:selected_article])]) It would appear that the ? is not be substituted with a quoted value. Rails generates a query that looks like this ...article_id = ?12345... instead of this ...article_id = ''12345''... Is this a known bug, a deprecated feature, or syntax error in my code I''ve managed to get away with so far? -- gw -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
On May 10, 2008, at 1:34 PM, Greg Willits wrote:> Have a working 1.2.6 application (OS X 10.4.11, Ruby 1.8.6), which > I am > now trying to run under 2.0.2 (via freeze). > > First snag I''ve run into that I can''t find any info on is that > Rails is > gagging on a simple .count statement like this: > > (Comment.count ["article_id = ?", (session[:selected_article])]) > > It would appear that the ? is not be substituted with a quoted value. > Rails generates a query that looks like this ...article_id = ?12345... > instead of this ...article_id = ''12345''... > > Is this a known bug, a deprecated feature, or syntax error in my code > I''ve managed to get away with so far?OK, yes, I found that it is deprecated, but that means it should still work? Anyway, updating the code to a full :conditions syntax works: (Comment.count(:conditions => ["article_id = ?", session [:selected_article]])) -- gw --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sat, May 10, 2008 at 6:12 PM, Greg Willits <lists-0Bv1hcaDFPRk211Z5VL+QA@public.gmane.org> wrote:> OK, yes, I found that it is deprecated, but that means it should > still work? > > Anyway, updating the code to a full :conditions syntax works: > > (Comment.count(:conditions => ["article_id = ?", session > [:selected_article]]))As far as can I remember, the deprecation warning tells you that this feature will be removed on rails 2 :) -- Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://codeshooter.wordpress.com/ (en) João Pessoa, PB, +55 83 8867-7208 --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---