Is there a way to make Rails ActiveRecord attributes private?

前端 未结 7 860
渐次进展
渐次进展 2020-12-08 13:48

By default, ActiveRecord takes all fields from the corresponding database table and creates public attributes for all of them.

I think that it\'s reasonable not<

7条回答
  •  广开言路
    2020-12-08 14:20

    You can make an existing method private:

    YourClass.send(:private, :your_method)
    

提交回复
热议问题