I am trying to migrate to heroku and I cannot find the problem why my model class is not recognized.
This is my migration:
class AddTestToGoals < ActiveRecord::Migration def change add_column :goals, :test, :integer, default: 0, null: false Goal.reset_column_information Goal.all.each { |g| g.update_attribute :test, Goal::PASS } end end
Launch using
heroku run rake db:migrate
and i get this error
uninitialized constant AddTestToGoals::Goal
Does anyone know what the problem is?
EDIT: skip typed earlier, this is a model that is not recognized, not a constant in it.
LATELY:
Using this (what I found here: http://visibletrap.blogspot.co.il/2011/10/heroku-access-railss-model-in-migration.html )
class AddTestToGoals < ActiveRecord::Migration class Goal < ActiveRecord::Base; end def change add_column :goals, :test, :integer, default: 0, null: false Goal.reset_column_information Goal.all.each { |g| g.update_attribute :test, Goal::PASS } end end
heroku does not complain that he does not know what the goal is, which solves half the problem. but then, Goal :: PASS is not recognized.
Odded source share