Sha256: f77f4ac19a78035570049b1c332dd434c30f04cc2f2291bfc5667dc7d42e9035

Contents?: true

Size: 389 Bytes

Versions: 4

Compression:

Stored size: 389 Bytes

Contents

class StateEvent < ActiveRecord::Base
  belongs_to :user
  belongs_to :stateful, :polymorphic => true
  before_create :assign_user

  def <=>(other)
    created_at <=> other.created_at
  end

  def assign_user
    if UserSession.activated? && current_user_session = UserSession.find
      self.user_id ||= current_user_session.user.id
    end
    true   # don't stop the filters
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_core-0.30.2 app/models/state_event.rb
spree_core-0.30.1 app/models/state_event.rb
spree_core-0.30.0 app/models/state_event.rb
spree_core-0.30.0.beta1 app/models/state_event.rb