モデルの変更を追跡していますが、has_many リレーションの変更を追跡したいと考えています。モデルには次のものがあります。
define_attribute_method :tag_tokens
attr_reader :tag_tokens
def tag_tokens=(ids)
tag_tokens_will_change! unless ids == @tag_tokens
self.tag_ids = ids.split(",")
end
http://railscasts.com/episodes/258-token-fieldsとhttp://api.rubyonrails.org/classes/ActiveModel/Dirty.htmlの組み合わせ
その結果、回線で発生するこの例外が発生しdefine_attribute_method
ます。メソッドを作成するには、このメソッドが必要だと思いますtag_tokens_will_change
。
ruby-1.9.3-p194@mm/gems/activerecord-3.2.8/lib/active_record/attribute_methods/time_zone_conversion.rb:59:in `create_time_zone_conversion_attribute?': undefined method `type' for nil:NilClass (NoMethodError)
どうすればこれを機能させることができますか?