Class: Cursed::Adapter::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/cursed/adapter/active_record.rb

Instance Attribute Summary

Attributes inherited from Base

#relation

Instance Method Summary collapse

Methods inherited from Base

#apply_to, #initialize

Constructor Details

This class inherits a constructor from Cursed::Adapter::Base

Instance Method Details

#after(attribute, value) ⇒ Object



18
19
20
# File 'lib/cursed/adapter/active_record.rb', line 18

def after(attribute, value)
  @relation = relation.where(relation.table[attribute].gt(value))
end

#ascend_by(attribute) ⇒ Object



10
11
12
# File 'lib/cursed/adapter/active_record.rb', line 10

def ascend_by(attribute)
  @relation = relation.reorder(attribute => :asc)
end

#before(attribute, value) ⇒ Object



22
23
24
# File 'lib/cursed/adapter/active_record.rb', line 22

def before(attribute, value)
  @relation = relation.where(relation.table[attribute].lt(value))
end

#descend_by(attribute) ⇒ Object



6
7
8
# File 'lib/cursed/adapter/active_record.rb', line 6

def descend_by(attribute)
  @relation = relation.reorder(attribute => :desc)
end

#limit(count) ⇒ Object



14
15
16
# File 'lib/cursed/adapter/active_record.rb', line 14

def limit(count)
  @relation = relation.limit(count)
end