ActiveRecord::AssociationTypeMismatch

Sorry for my english.

I have to create twitter like app. I created 3 models User, Tweet,
Followership

class User < ActiveRecord::Base
has_many :tweets
accepts_nested_attributes_for :tweets
has_many :followerships, class_name: ‘Followership’, foreign_key:
‘followed_id’
has_many :followerships, class_name: ‘Followership’, foreign_key:
‘follower_id’
has_many :followed, through: :followedships, source: :followed
has_many :followers, through: :followerships, source: :follower
end
class Tweet < ActiveRecord::Base
belongs_to :user
end
class Followership < ActiveRecord::Base
belongs_to :follower, class_name: ‘User’
belongs_to :followed, class_name: ‘User’
end

I have yaml file with UTF-8 data to add to my db. I changed my
seeds.rb file in such a way:
seed_file = File.join(Rails.root, ‘db’, ‘seeds.yml’)
config = YAML::load_file(seed_file)
User.create(config[“users”])
Followership.create(config[“followerships”])

Then i tried to run rake db:seed and got
alexkd@Active-pc:~/WebDev/rails/twitter$ rake db:seed
rake aborted!
ActiveRecord::AssociationTypeMismatch: Tweet(#97039630) expected, got
Hash(#81744670)

Whats the problem? I have no ideas. ruby 2.0, Rails 4.1.0, sQlite3

On Saturday, 17 May 2014 20:35:47 UTC-4, McCauley wrote:

‘followed_id’
belongs_to :followed, class_name: ‘User’
alexkd@Active-pc:~/WebDev/rails/twitter$ rake db:seed
rake aborted!
ActiveRecord::AssociationTypeMismatch: Tweet(#97039630) expected, got
Hash(#81744670)

Hard to say for certain without a backtrace or the yaml, but my first
guess
would be that you’re trying to assign to tweets instead of the
tweets_attributes method that accepts_nested_attributes has
generated.

–Matt J.