vendredi 18 septembre 2015

Cannot create records from rails seeds, fails with undefined method `generated_methods?'

I recently upgraded an app from rails 2.3.18 to rails 3.2.1 and I'm trying to fully migrate it.

When I run rake db:seeds, it fails with:

 undefined method `generated_methods?' for WhateverObject

This is the content of a very basic seed file:

[ 'MTW', 'GBP', 'USD', 'EUR' ].each do |currency|
  binding.pry
  Currency.find_or_create_by_code(currency)
end

Through pry, I noticed that I cannot call any of the methods like:

Currency.new Currency.create

I also tried with:

Currency.where(code: currency).first_or_create

Currency.column_names
=> ["id", "code", "rate"]

What's wrong here?

Aucun commentaire:

Enregistrer un commentaire