Deprecated warning for Rails 4 has_many with order

前端 未结 5 1868
情话喂你
情话喂你 2020-11-27 14:08
class RelatedList < ActiveRecord::Base
  extend Enumerize

  enumerize :list_type, in: %w(groups projects)

  belongs_to :content
  has_many :contents, :order =&g         


        
5条回答
  •  清歌不尽
    2020-11-27 14:50

    Just thought I'd add that if you have any option hash arguments, they have to go after the lambda, like this:

    has_many :things, -> { order :stuff }, dependent: :destroy
    

    Took me a minute to figure this out myself - hopefully it helps anyone else coming to this question having the same problem.

提交回复
热议问题