How do I replicate class_inheritable_accessor's behavior in Rails 3.1?

前端 未结 2 2016
Happy的楠姐
Happy的楠姐 2021-02-07 10:52

Beginning with Rails 3.1, class_inheritable_accessor produces deprecation warnings, telling me to use class_attribute instead. But class_attribut

2条回答
  •  故里飘歌
    2021-02-07 11:36

    class_attribute won't pollute its parent if it's used as intended. Make sure you're not changing the mutable items in-place.

    types_and_classes.keys.each do |t|
      self.presented = presented.merge({t => types_and_classes[t]})
    end
    

提交回复
热议问题