What does this rake db:seed error mean?
I've been trying to solve this problem for a couple of hours but I can't seem to understand what's going on.
I'm using Rails 3 beta, and want to seed some data to the database. However, when I try to seed some values through db:seed, I get this error:
rake aborted!
Attribute(#81402440) expected, got Array(#69024170)
The seeds.rb is:
DataType.delete_all
DataType.create(
:name => 'String'
)
And I got these classes:
class DataType < ActiveRecord::Base
has_many :attributes
end
class Attribute < ActiveRecord::Base
belongs_to :data_types
end
Just to clarify, the intention is h开发者_如何学Pythonaving Attribute objects have one data type (such as String, Number, etc.).
While the migration definition for DataType is merely:
class CreateDataTypes < ActiveRecord::Migration
def self.up
create_table :data_types do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :data_types
end
end
Can anyone tell me what I'm doing wrong?
"Attribute" may be conflicting with something. Try renaming your Attribute
model.
精彩评论