Files
openfoodnetwork/app/models/spree/state_change.rb
Maikel Linke 8ef6966891 Declare old belongs_to default on remaining models
It would take ages to go through all files now and assess all belongs_to
associations. So I just declare the old default and then we can move on
and apply the new default for the application while these classes still
use the old one. All new models will then use the new default which is
the goal of this excercise and we can refactor old classes when we touch
them anyway.
2023-08-11 10:14:43 +10:00

20 lines
370 B
Ruby

# frozen_string_literal: true
module Spree
class StateChange < ApplicationRecord
self.belongs_to_required_by_default = false
belongs_to :user
belongs_to :stateful, polymorphic: true
before_create :assign_user
def <=>(other)
created_at <=> other.created_at
end
def assign_user
true # don't stop the filters
end
end
end