has_and_belongs_to_many などの Rails 関連付けをcache
オプションで拡張しようとしています。
has_and_belongs_to_many :posts, cache: true
バンドルされている ActiveRecord gem を直接編集している場合は問題なく動作します。
module ActiveRecord::Associations::Builder
class CollectionAssociation < Association #:nodoc:
[...]
def valid_options
super + [:table_name, :finder_sql, :counter_sql, :before_add,
:after_add, :before_remove, :after_remove, :extend,
:cache]
end
[...]
end
end
しかし、このクラスをモンキーパッチ、オーバーライド、または拡張するためのクリーンな方法についてはわかりません。