У меня есть
class Store < ActiveRecord::Base
belongs_to :user
has_many :products, :as => :imageable
end
class User < ActiveRecord::Base
has_one :store
has_many :products, :as => imageable
end
class Product < ActiveRecord::Base
belongs_to :imageable, :polymorphic => true
end
и я мигрировал:
class AddImageableToProducts < ActiveRecord::Migration
def self.up
change_table :products do |t|
t.references :imageable, :polymorphic => true
end
end
def self.down
remove_column :products, :imageable
end
end
Когда я пытаюсь запустить свое приложение, я получаю: неопределенная локальная переменная или метод `imageable', и я не знаю, чего мне не хватает для этого запуска. Я признателен, если кто-то может помочь. Спасибо