class Event < ActiveRecord::Base default_scope :conditions => "id = 1" end Event.new undefined method `1='' for #<Event:0xb68ce02c> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
class Event < ActiveRecord::Base default_scope :conditions => {:id = 1} end just a guess On Mar 16, 4:54 pm, David Beckwith <dbitsoluti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> class Event < ActiveRecord::Base > default_scope :conditions => "id = 1" > end > > Event.new > > undefined method `1='' for #<Event:0xb68ce02c>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
":id => 1" or {:id =>1} On Mar 16, 6:08 am, "\"Wolas!\"" <jcpen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> class Event < ActiveRecord::Base > default_scope :conditions => {:id = 1} > end > > just a guess > > On Mar 16, 4:54 pm, David Beckwith <dbitsoluti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > class Event < ActiveRecord::Base > > default_scope :conditions => "id = 1" > > end > > > Event.new > > > undefined method `1='' for #<Event:0xb68ce02c>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mar 16, 3:54 pm, David Beckwith <dbitsoluti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> class Event < ActiveRecord::Base > default_scope :conditions => "id = 1" > end > > Event.new > > undefined method `1='' for #<Event:0xb68ce02c>With regards to the other responses, your syntax is fine. Default_scope with conditions has seemed a bit broken recently (http:// rails.lighthouseapp.com/projects/8994/tickets/2199-default_scope- errors-with-named_scope) but I''ve just updated to tag v2.3.2 and your specific example now works fine. Hope that helps. Andrew --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Fwiw, I''m seeing similar things even on 2.3.2, with slightly different default_scopes: default_scope :conditions => ["played_on < ?", Time.now] leads to: undefined method `played_on < ?='' for #<Game:0x21c5e88> (when Game.new is called) when I call Game.new Best, Rick (and, yes, I know Time.now isn''t going to do what I expect, just ended up there while trying to troubleshoot the problem) On Mar 16, 2:08 pm, Andrew France <andrew+li...-nb9sXpffzH/10XsdtD+oqA@public.gmane.org> wrote:> On Mar 16, 3:54 pm, David Beckwith <dbitsoluti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > class Event < ActiveRecord::Base > > default_scope :conditions => "id = 1" > > end > > > Event.new > > > undefined method `1='' for #<Event:0xb68ce02c> > > With regards to the other responses, your syntax is fine. > Default_scope with conditions has seemed a bit broken recently (http:// > rails.lighthouseapp.com/projects/8994/tickets/2199-default_scope- > errors-with-named_scope) but I''ve just updated to tag v2.3.2 and your > specific example now works fine. > > Hope that helps. > Andrew--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Any news on this? I''m also on Rails 2.3.2. and can''t find a way around this bug. On Mar 17, 9:32 pm, Rick Bradley <rick.brad...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Fwiw, I''m seeing similar things even on 2.3.2, with slightly different > default_scopes: > > default_scope :conditions => ["played_on < ?", Time.now] > > leads to: > > undefined method `played_on < ?='' for #<Game:0x21c5e88> (when > Game.new is called) > > when I call Game.new > > Best, > Rick > > (and, yes, I know Time.now isn''t going to do what I expect, just ended > up there while trying to troubleshoot the problem) > > On Mar 16, 2:08 pm, Andrew France <andrew+li...-nb9sXpffzH/10XsdtD+oqA@public.gmane.org> wrote: > > > > > On Mar 16, 3:54 pm, David Beckwith <dbitsoluti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > class Event < ActiveRecord::Base > > > default_scope :conditions => "id = 1" > > > end > > > > Event.new > > > > undefined method `1='' for #<Event:0xb68ce02c> > > > With regards to the other responses, your syntax is fine. > > Default_scope with conditions has seemed a bit broken recently (http:// > > rails.lighthouseapp.com/projects/8994/tickets/2199-default_scope- > > errors-with-named_scope) but I''ve just updated to tag v2.3.2 and your > > specific example now works fine. > > > Hope that helps. > > Andrew