Hi! I''m getting this strange migration error for this migration:
class CreateCustomers < ActiveRecord::Migration
def self.up
Customer.create :name => ''TEST'', :zone_id => 0
end
def self.down
Customer.delete_all
end
end
Produces:
== CreateCustomers: migrating
================================================--
create({:name=>"TEST", :zone_id=>0})
rake aborted!
undefined method `create'' for
#<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x46c2204>
I "fixed" it by defining the customer model inside the migration. Why
is
happening this? (the same kind of migrations are working for all my
models except "Customer")
class CreateCustomers < ActiveRecord::Migration
class Customer < ActiveRecord::Base
end
def self.up
Customer.create :name => ''TEST'', :zone_id => 0
end
def self.down
Customer.delete_all
end
end
--
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
-~----------~----~----~----~------~----~------~--~---