What does this rake db:seed error mean?

Posted by Kenji Kina on Stack Overflow See other posts from Stack Overflow or by Kenji Kina
Published on 2010-05-08T01:46:19Z Indexed on 2010/05/08 1:58 UTC
Read the original article Hit count: 428

Filed under:
|
|

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

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?

© Stack Overflow or respective owner

Related posts about rake

Related posts about error