Rails: Model instance method or helper method?

前端 未结 2 795
别那么骄傲
别那么骄傲 2021-01-04 09:40

By convention, should the following be defined as an instance method of my model or a helper method?

# app/models/user.rb
class User < ActiveRecord::Base
         


        
2条回答
  •  醉梦人生
    2021-01-04 10:18

    Go with the first (keep in model), also because you might want to do other stuff, like combined indexes :)

提交回复
热议问题