Should I use class method or instance method, and why?

后端 未结 4 611
生来不讨喜
生来不讨喜 2021-02-02 03:06

In my Rails app, when creating a business I have a form that has the following field:

   <%= check_box_tag(:default_company) %> 
   <%= label_tag(:defau         


        
4条回答
  •  误落风尘
    2021-02-02 04:00

    In my opinion, I always create a class method if the method in question represents information/behavior that is quite generic among all the objects instantiated, different from the instance methods, that I use when I believe it's more like a specific action of the instantiated object in question.

    But that is my point-of-view.

提交回复
热议问题