Making a public setter method private in a subclass

前端 未结 0 1865
感情败类
感情败类 2020-12-29 00:08

In order to turn a setter that ActiveRecord generates for you, the following pattern can be used:

class ParentModel
  def name=(name)
    @attributes ||= {}
          


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题