In one of my migration files I have the following: =========== def self.up User.create :name => 'John K.', :email => 'firstname.lastname@example.org', :password => 'test' end =========== When I run it I get the following error: =========== undefined method `create' for #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x2345c1c> =========== When I copy the line and paste it in console it works perfectly. Even using the longer method of =========== user = User.new user.name user.save =========== Does not work in the migration. Tells me method name does not exist. It exists. Anyone have any insight about this. Problem has been driving me crazy for the last 30 minutes. :-) Your Friend John K.
on 2006-03-21 20:01
on 2006-03-21 20:10
Try putting class User < ActiveRecord::Base; end; In your migration. I forget if it needs to go inside or outside the migration class (I'd think inside), so if one doesn't work, give the other one a shot. Pat
on 2006-03-21 20:28
I even started getting some funny errors like ============= superclass mismatch for class User ============= I ended up deleting the user model and migration files and started again and it worked perfectly. Thanks On 21-Mar-06, at 1:07 PM, Pat M. wrote: > >> >> =========== >> > Rails mailing list > email@example.com > http://lists.rubyonrails.org/mailman/listinfo/rails John K.