Ruby on rails 4 RubyonRails+;变形虫宝石:未定义的方法&x27;宏';
我在Rails控制台(使用Ruby 2.1)中尝试了阿米巴版本2.0.0。这是我的模型:Ruby on rails 4 RubyonRails+;变形虫宝石:未定义的方法&x27;宏';,ruby-on-rails-4,clone,amoeba-gem,Ruby On Rails 4,Clone,Amoeba Gem,我在Rails控制台(使用Ruby 2.1)中尝试了阿米巴版本2.0.0。这是我的模型: class Dict < ActiveRecord::Base belongs_to :user has_many :cards, dependent: :destroy has_many :idioms, through: :cards end class Card < ActiveRecord::Base belongs_to :dict has_many :idioms
class Dict < ActiveRecord::Base
belongs_to :user
has_many :cards, dependent: :destroy
has_many :idioms, through: :cards
end
class Card < ActiveRecord::Base
belongs_to :dict
has_many :idioms, dependent: :destroy
amoeba do
exclude_field :dict_id
end
end
class Idiom < ActiveRecord::Base
belongs_to :card
amoeba do
include_field :repres
include_field :card_id
include_field :kind
include_field :note
end
end
这引发了一个例外
NoMethodError: undefined method macro' for nil:NilClass
from .../amoeba-2.0.0/lib/amoeba.rb:412:in amo_process_association'
from .../amoeba-2.0.0/lib/amoeba.rb:381:in block in amoeba_dup'
from .../amoeba-2.0.0/lib/amoeba.rb:379:in each'
from ..../amoeba-2.0.0/lib/amoeba.rb:379:in amoeba_dup'
from .../amoeba-2.0.0/lib/amoeba.rb:457:in block in amo_process_association'
我在哪里犯了错误?GitHub上也提出了这个问题: 这是由于
include\u字段
用于非关联的内容造成的。不要那样做!为了避免将来出现歧义,include\u字段
被重命名为include\u关联
NoMethodError: undefined method macro' for nil:NilClass
from .../amoeba-2.0.0/lib/amoeba.rb:412:in amo_process_association'
from .../amoeba-2.0.0/lib/amoeba.rb:381:in block in amoeba_dup'
from .../amoeba-2.0.0/lib/amoeba.rb:379:in each'
from ..../amoeba-2.0.0/lib/amoeba.rb:379:in amoeba_dup'
from .../amoeba-2.0.0/lib/amoeba.rb:457:in block in amo_process_association'