lunaclaire
2009-Nov-30 21:02 UTC
rails 2.2.3 dirty.rb field_changed? method throwing arg error on creating an obj
I have a new model I''ve just built. It''s associated with another model via has_many. I''m trying to create one of these obj''s for the first time and I keep getting an Argument Error as follows: ArgumentError (wrong number of arguments (3 for 0)): C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.3/lib/ active_record/dirty.rb:135:in `field_changed?'' this happens when I try to create the obj, but it''s deep in the rails codebase and I cant figure out why it''s happening. I''ve tried both creating the object as part of the association like this: self.updates.create() and directly like this: update = Update.create() or update = Update.new() with and without values passed in as a hash and get the same results every time. has anyone else seen this? -- 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.
Frederick Cheung
2009-Nov-30 22:17 UTC
Re: rails 2.2.3 dirty.rb field_changed? method throwing arg error on creating an obj
On Nov 30, 9:02 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a new model I''ve just built. It''s associated with another model > via has_many. I''m trying to create one of these obj''s for the first > time and I keep getting an Argument Error as follows: > > ArgumentError (wrong number of arguments (3 for 0)): > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.3/lib/ > active_record/dirty.rb:135:in `field_changed?'' > > this happens when I try to create the obj, but it''s deep in the rails > codebase and I cant figure out why it''s happening. >What columns / associations/ methods does your model have ? I''d guess that one of these is accidentally overriding a core activerecord method. Fred> I''ve tried both creating the object as part of the association like > this: > > self.updates.create() > > and directly like this: > > update = Update.create() or update = Update.new() > > with and without values passed in as a hash and get the same results > every time. > > has anyone else seen this?-- 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.
lunaclaire
2009-Nov-30 22:27 UTC
Re: rails 2.2.3 dirty.rb field_changed? method throwing arg error on creating an obj
from the migration that created the table: create_table :updates do |t| t.integer :update_request_id t.integer :change_type t.integer :assoc_obj_id t.string :field_changed t.string :new_value t.timestamps end anything pop out there? I did try to name these attribs to avoid a clash, but perhaps I missed something? On Nov 30, 2:17 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 30, 9:02 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have a new model I''ve just built. It''s associated with another model > > via has_many. I''m trying to create one of these obj''s for the first > > time and I keep getting an Argument Error as follows: > > > ArgumentError (wrong number of arguments (3 for 0)): > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.3/lib/ > > active_record/dirty.rb:135:in `field_changed?'' > > > this happens when I try to create the obj, but it''s deep in the rails > > codebase and I cant figure out why it''s happening. > > What columns / associations/ methods does your model have ? I''d guess > that one of these is accidentally overriding a core activerecord > method. > > Fred > > > I''ve tried both creating the object as part of the association like > > this: > > > self.updates.create() > > > and directly like this: > > > update = Update.create() or update = Update.new() > > > with and without values passed in as a hash and get the same results > > every time. > > > has anyone else seen this? > >-- 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.
lunaclaire
2009-Nov-30 23:48 UTC
Re: rails 2.2.3 dirty.rb field_changed? method throwing arg error on creating an obj
sorry... we added to the original migration so that now the attr''s are t.integer :update_request_id t.integer :change_type t.integer :assoc_obj_id t.string :field_changed t.string :new_value t.integer :resolution t.timestamps On Nov 30, 2:27 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> from the migration that created the table: > > create_table :updates do |t| > t.integer :update_request_id > t.integer :change_type > t.integer :assoc_obj_id > t.string :field_changed > t.string :new_value > > t.timestamps > end > > anything pop out there? I did try to name these attribs to avoid a > clash, but perhaps I missed something? > > On Nov 30, 2:17 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > On Nov 30, 9:02 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I have a new model I''ve just built. It''s associated with another model > > > via has_many. I''m trying to create one of these obj''s for the first > > > time and I keep getting an Argument Error as follows: > > > > ArgumentError (wrong number of arguments (3 for 0)): > > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.3/lib/ > > > active_record/dirty.rb:135:in `field_changed?'' > > > > this happens when I try to create the obj, but it''s deep in the rails > > > codebase and I cant figure out why it''s happening. > > > What columns / associations/ methods does your model have ? I''d guess > > that one of these is accidentally overriding a core activerecord > > method. > > > Fred > > > > I''ve tried both creating the object as part of the association like > > > this: > > > > self.updates.create() > > > > and directly like this: > > > > update = Update.create() or update = Update.new() > > > > with and without values passed in as a hash and get the same results > > > every time. > > > > has anyone else seen this? > >-- 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.
Frederick Cheung
2009-Nov-30 23:55 UTC
Re: rails 2.2.3 dirty.rb field_changed? method throwing arg error on creating an obj
On Nov 30, 11:48 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> sorry... we added to the original migration so that now the attr''s are > > t.integer :update_request_id > t.integer :change_type > t.integer :assoc_obj_id > t.string :field_changed > t.string :new_value > t.integer :resolution >field_changed is the one (the fact that the error message is talking about field_changed is a hint in that direction Fred> t.timestamps > > On Nov 30, 2:27 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > from the migration that created the table: > > > create_table :updates do |t| > > t.integer :update_request_id > > t.integer :change_type > > t.integer :assoc_obj_id > > t.string :field_changed > > t.string :new_value > > > t.timestamps > > end > > > anything pop out there? I did try to name these attribs to avoid a > > clash, but perhaps I missed something? > > > On Nov 30, 2:17 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > On Nov 30, 9:02 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have a new model I''ve just built. It''s associated with another model > > > > via has_many. I''m trying to create one of these obj''s for the first > > > > time and I keep getting an Argument Error as follows: > > > > > ArgumentError (wrong number of arguments (3 for 0)): > > > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.3/lib/ > > > > active_record/dirty.rb:135:in `field_changed?'' > > > > > this happens when I try to create the obj, but it''s deep in the rails > > > > codebase and I cant figure out why it''s happening. > > > > What columns / associations/ methods does your model have ? I''d guess > > > that one of these is accidentally overriding a core activerecord > > > method. > > > > Fred > > > > > I''ve tried both creating the object as part of the association like > > > > this: > > > > > self.updates.create() > > > > > and directly like this: > > > > > update = Update.create() or update = Update.new() > > > > > with and without values passed in as a hash and get the same results > > > > every time. > > > > > has anyone else seen this?-- 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.
lunaclaire
2009-Dec-01 00:06 UTC
Re: rails 2.2.3 dirty.rb field_changed? method throwing arg error on creating an obj
OMG, you''re right! Couldnt see the forest for the trees. Thx, Fred! This didnt show up in any lists I looked at for MagicReservedwords and such... I might have to find time to walk thru the rils code to see what other names could clash w method names. thx again On Nov 30, 3:55 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 30, 11:48 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > sorry... we added to the original migration so that now the attr''s are > > > t.integer :update_request_id > > t.integer :change_type > > t.integer :assoc_obj_id > > t.string :field_changed > > t.string :new_value > > t.integer :resolution > > field_changed is the one (the fact that the error message is talking > about field_changed is a hint in that direction > > Fred > > > t.timestamps > > > On Nov 30, 2:27 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > from the migration that created the table: > > > > create_table :updates do |t| > > > t.integer :update_request_id > > > t.integer :change_type > > > t.integer :assoc_obj_id > > > t.string :field_changed > > > t.string :new_value > > > > t.timestamps > > > end > > > > anything pop out there? I did try to name these attribs to avoid a > > > clash, but perhaps I missed something? > > > > On Nov 30, 2:17 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > On Nov 30, 9:02 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I have a new model I''ve just built. It''s associated with another model > > > > > via has_many. I''m trying to create one of these obj''s for the first > > > > > time and I keep getting an Argument Error as follows: > > > > > > ArgumentError (wrong number of arguments (3 for 0)): > > > > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.3/lib/ > > > > > active_record/dirty.rb:135:in `field_changed?'' > > > > > > this happens when I try to create the obj, but it''s deep in the rails > > > > > codebase and I cant figure out why it''s happening. > > > > > What columns / associations/ methods does your model have ? I''d guess > > > > that one of these is accidentally overriding a core activerecord > > > > method. > > > > > Fred > > > > > > I''ve tried both creating the object as part of the association like > > > > > this: > > > > > > self.updates.create() > > > > > > and directly like this: > > > > > > update = Update.create() or update = Update.new() > > > > > > with and without values passed in as a hash and get the same results > > > > > every time. > > > > > > has anyone else seen this? > >-- 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.
Colin Law
2009-Dec-01 10:52 UTC
Re: Re: rails 2.2.3 dirty.rb field_changed? method throwing arg error on creating an obj
2009/12/1 lunaclaire <szagerman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> OMG, you''re right! Couldnt see the forest for the trees. Thx, Fred! > > This didnt show up in any lists I looked at for MagicReservedwords and > such... I might have to find time to walk thru the rils code to see > what other names could clash w method names. > > thx again > > On Nov 30, 3:55 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On Nov 30, 11:48 pm, lunaclaire <szager...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > sorry... we added to the original migration so that now the attr''s are >> >> > t.integer :update_request_id >> > t.integer :change_type >> > t.integer :assoc_obj_id >> > t.string :field_changed >> > t.string :new_value >> > t.integer :resolution >> >> field_changed is the one (the fact that the error message is talking >> about field_changed is a hint in that direction >> >> FredI have added field_changed to the list at http://wiki.rubyonrails.org/rails/pages/reservedwords Colin -- 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.