Class: Spree::Activator

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/spree/activator.rb

Direct Known Subclasses

Promotion

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.activeObject



17
18
19
20
# File 'app/models/spree/activator.rb', line 17

def self.active
  where('starts_at IS NULL OR starts_at < ?', Time.now).
    where('expires_at IS NULL OR expires_at > ?', Time.now)
end

.register_event_name(name) ⇒ Object



11
12
13
# File 'app/models/spree/activator.rb', line 11

def self.register_event_name(name)
  self.event_names << name
end

Instance Method Details

#activate(payload) ⇒ Object



22
23
# File 'app/models/spree/activator.rb', line 22

def activate(payload)
end

#expired?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/models/spree/activator.rb', line 25

def expired?
  starts_at && Time.now < starts_at || expires_at && Time.now > expires_at
end