Module: Subly::ClassMethods

Defined in:
lib/subly.rb

Instance Method Summary collapse

Instance Method Details

#with_active_subscription(name) ⇒ Object



33
34
35
36
# File 'lib/subly.rb', line 33

def with_active_subscription(name)
  now = Time.now
  with_subscription(name).scoped(:joins => :sublies, :conditions => ['subly_models.starts_at <= ? AND (ends_at IS NULL or ends_at > ?)', now, now])
end

#with_subscription(name) ⇒ Object



29
30
31
# File 'lib/subly.rb', line 29

def with_subscription(name)
  scoped(:include => :sublies, :conditions => {:subly_models => {:name => name}})
end