0
我在Rails中遇到了多态性问题。未定义的局部变量或方法<object> for#<Class:0x55ebe50>
我有这样的文件:
class CreateExecutions < ActiveRecord::Migration
def change
create_table :executions do |t|
t.integer :player_space_id
t.integer :what_id
t.references :what, polymorphic: true
t.integer :qty
t.integer :level
t.datetime :when_ready
t.timestamps
end
end
end
class Execution < ActiveRecord::Base
belongs_to :what, :polymorphic => true
end
class Element < ActiveRecord::Base
belongs_to :game_space
has_many :levels
has_many :player_elements
has_many :executions, :as => what
end
class PlayerSpace < ActiveRecord::Base
belongs_to :game_space
belongs_to :user
has_many :executions, as: :what
end
当我运行的具有元件的控制器,我有这样的错误:
NameError在PlayerSpacesController#显示 未定义的局部变量或方法'什么”为#
愿你帮我