hey everyone, having some weird experiences when creating a new record with active record.. doesn''t active_record automagically handle created_on and updated_on coloumns? I keep getting errors:: ArgumentError: wrong number of arguments (1 for 0) /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:328:in `notify'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:328:in `callback'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:295:in `valid?'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/validations.rb:751:in `save_without_transactions'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:129:in `save'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in `transaction'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:95:in `transaction'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:121:in `transaction'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:129:in `save'' ./test/unit/user_test.rb:46:in `test_create_user'' I understand what the error is saying about wrong arguments.. but none of my methods are using any arguments.. Here is the test script i''ve written to test i.. require ''rubygems'' require ''active_record'' class Users < ActiveRecord::Base end class T def initialize ActiveRecord::Base.establish_connection( :adapter => "mysql", :host => "localhost", :username => "root", :password => "", :database => "something_dev" ) end def ctest @nu = Users.new({ :user_name => ''davidh'', :first_name => ''david'', :last_name => ''hasselhoffenmeier'', :phone => ''34928293'', :email => ''adasdf-E+pzHk2C6QJWk0Htik3J/w@public.gmane.org'', :company => ''whatever'', :user_type => 0, :notify => 0}) @nu.save end end @r = T.new @r.ctest --my table has a created_on column as a date type, and I get the above errors when running this script.. any ideas? thanks all -- 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 -~----------~----~----~----~------~----~------~--~---
aaronsmith wrote:> hey everyone, having some weird experiences when creating a new record > with active record.. > > doesn''t active_record automagically handle created_on and updated_on > coloumns? I keep getting errors:: > > ArgumentError: wrong number of arguments (1 for 0) > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:328:in > `notify'' > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:328:in > `callback'' > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:295:in > `valid?'' > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/validations.rb:751:in > `save_without_transactions'' > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:129:in > `save'' > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in > `transaction'' > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:95:in > `transaction'' > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:121:in > `transaction'' > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:129:in > `save'' > ./test/unit/user_test.rb:46:in `test_create_user'' > > > I understand what the error is saying about wrong arguments.. but none > of my methods are using any arguments.. Here is the test script i''ve > written to test i.. > > > > require ''rubygems'' > require ''active_record'' > > class Users < ActiveRecord::Base > end > > class T > def initialize > ActiveRecord::Base.establish_connection( > :adapter => "mysql", > :host => "localhost", > :username => "root", > :password => "", > :database => "something_dev" > ) > end > > def ctest > @nu = Users.new({ > :user_name => ''davidh'', > :first_name => ''david'', > :last_name => ''hasselhoffenmeier'', > :phone => ''34928293'', > :email => ''adasdf-E+pzHk2C6QJWk0Htik3J/w@public.gmane.org'', > :company => ''whatever'', > :user_type => 0, > :notify => 0}) > @nu.save > end > end > > @r = T.new > @r.ctest > > > --my table has a created_on column as a date type, and I get the above > errors when running this script.. > any ideas? > > thanks all > >Not sure if this helps, but I think created_on needs to be a timestamp not a date.. Cheers Mohit. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Not sure if this helps, but I think created_on needs to be a timestamp > not a date.. > Cheers > Mohit.Shoot - that didn''t seem to help any.. it seems like there is actually a bigger problem. As I have taken out the created_on column, and now when I run my unit tests I still get that error.. Is there anything that migrations do specifically to a database to be active record friendly? As I have not been using migrations.. just using navicat and hacking away. -- 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 -~----------~----~----~----~------~----~------~--~---
aaronsmith wrote:>> Not sure if this helps, but I think created_on needs to be a timestamp >> not a date.. >> Cheers >> Mohit. >> > > Shoot - that didn''t seem to help any.. it seems like there is actually a > bigger problem. As I have taken out the created_on column, and now when > I run my unit tests I still get that error.. > > Is there anything that migrations do specifically to a database to be > active record friendly? As I have not been using migrations.. just using > navicat and hacking away. > >I think the only main difference is that they will by default create an auto-increment field called ''id'' that serves as the primary key. Are you creating one? Cheers Mohit. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mohit Sindhwani wrote:> aaronsmith wrote: >> Is there anything that migrations do specifically to a database to be >> active record friendly? As I have not been using migrations.. just using >> navicat and hacking away. >> >> > I think the only main difference is that they will by default create an > auto-increment field called ''id'' that serves as the primary key. > Are you creating one? > > Cheers > Mohit.yes.. and actually.. the only time this is happening is when i''ve got a created_on column in the database. I''ve tried numerous different data types (date, datetime, timestamp).. when using ActiveRecord by itself it didn''t matter.. but now when tying it through rails.. it just fails all together.. -- 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 -~----------~----~----~----~------~----~------~--~---
aaronsmith wrote:> Mohit Sindhwani wrote: > >> aaronsmith wrote: >> >>> Is there anything that migrations do specifically to a database to be >>> active record friendly? As I have not been using migrations.. just using >>> navicat and hacking away. >>> >>> >>> >> I think the only main difference is that they will by default create an >> auto-increment field called ''id'' that serves as the primary key. >> Are you creating one? >> >> Cheers >> Mohit. >> > > yes.. and actually.. the only time this is happening is when i''ve got a > created_on column in the database. I''ve tried numerous different data > types (date, datetime, timestamp).. when using ActiveRecord by itself it > didn''t matter.. but now when tying it through rails.. it just fails all > together.. > >sorry, I''m at wits'' ends here - haven''t experienced this issue at all. I do hope that someone else replies to the thread :-S Cheers Mohit. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mohit Sindhwani wrote:> aaronsmith wrote: >>> I think the only main difference is that they will by default create an >> didn''t matter.. but now when tying it through rails.. it just fails all >> together.. >> >> > sorry, I''m at wits'' ends here - haven''t experienced this issue at all. > I do hope that someone else replies to the thread :-S > > Cheers > Mohit.AHH.. I got it.. one of my colum names was ''notify'', and apparently active_record doesn''t like that. there must be a notify method on active_record. -A -- 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 6-Apr-07, at 12:07 PM, Mohit Sindhwani wrote:> > aaronsmith wrote: >> Mohit Sindhwani wrote: >> >>> aaronsmith wrote: >>> >>>> Is there anything that migrations do specifically to a database >>>> to be >>>> active record friendly? As I have not been using migrations.. >>>> just using >>>> navicat and hacking away. >>>> >>>> >>>> >>> I think the only main difference is that they will by default >>> create an >>> auto-increment field called ''id'' that serves as the primary key. >>> Are you creating one? >>> >>> Cheers >>> Mohit. >>> >> >> yes.. and actually.. the only time this is happening is when i''ve >> got a >> created_on column in the database. I''ve tried numerous different data >> types (date, datetime, timestamp).. when using ActiveRecord by >> itself it >> didn''t matter.. but now when tying it through rails.. it just >> fails all >> together.. >> >> > sorry, I''m at wits'' ends here - haven''t experienced this issue at all. > I do hope that someone else replies to the thread :-S > > Cheers > Mohit. > >This feels like a red-herring. try to create a simple project that replicates the problem. I suspect that in your current project something else is triggering this happen - a plugin, a callback. Cheers, Jodi General Partner The nNovation Group inc. www.nnovation.ca/blog --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
aaronsmith wrote:> Mohit Sindhwani wrote: > >> aaronsmith wrote: >> >>>> I think the only main difference is that they will by default create an >>>> >>> didn''t matter.. but now when tying it through rails.. it just fails all >>> together.. >>> >>> >>> >> sorry, I''m at wits'' ends here - haven''t experienced this issue at all. >> I do hope that someone else replies to the thread :-S >> >> Cheers >> Mohit. >> > > AHH.. I got it.. one of my colum names was ''notify'', and apparently > active_record doesn''t like that. there must be a notify method on > active_record. > > -A > >Good to know that, phew! Cheers Mohit. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
aaronsmith wrote:> Mohit Sindhwani wrote: >> aaronsmith wrote: >>>> I think the only main difference is that they will by default create an >>> didn''t matter.. but now when tying it through rails.. it just fails all >>> together.. >>> >>> >> sorry, I''m at wits'' ends here - haven''t experienced this issue at all. >> I do hope that someone else replies to the thread :-S >> >> Cheers >> Mohit. > > AHH.. I got it.. one of my colum names was ''notify'', and apparently > active_record doesn''t like that. there must be a notify method on > active_record. > > -AIs there a comprehensive list of column names that one should avoid unless they are using the build-in functionality eg "created_on/at" "updated_on/at" etc... JFM -- 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 -~----------~----~----~----~------~----~------~--~---
Not that i''m aware of. -- 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 -~----------~----~----~----~------~----~------~--~---