mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
Rails 5 introduced this new class to confine application-specific monkey patches to our models only, and not leak into other libraries using ActiveRecord::Base. https://bigbinary.com/blog/application-record-in-rails-5
18 lines
321 B
Ruby
18 lines
321 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Spree
|
|
class StateChange < ApplicationRecord
|
|
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
|