Module: MotionRecord::ScopeHelpers::ClassMethods

Defined in:
lib/motion_record/scope_helpers.rb

Instance Method Summary collapse

Instance Method Details

#average(column) ⇒ Object



64
65
66
# File 'lib/motion_record/scope_helpers.rb', line 64

def average(column)
  scoped.average(column)
end

#count(column = nil) ⇒ Object

Calculations



48
49
50
# File 'lib/motion_record/scope_helpers.rb', line 48

def count(column=nil)
  scoped.count(column)
end

#delete_allObject



42
43
44
# File 'lib/motion_record/scope_helpers.rb', line 42

def delete_all
  scoped.delete_all
end

#exists?Boolean

Read-only queries

Returns:

  • (Boolean)


16
17
18
# File 'lib/motion_record/scope_helpers.rb', line 16

def exists?
  scoped.exists?
end

#find(id) ⇒ Object



24
25
26
# File 'lib/motion_record/scope_helpers.rb', line 24

def find(id)
  scoped.find(id)
end

#find_allObject



28
29
30
# File 'lib/motion_record/scope_helpers.rb', line 28

def find_all
  scoped.find_all
end

#firstObject



20
21
22
# File 'lib/motion_record/scope_helpers.rb', line 20

def first
  scoped.first
end

#limit(limit_value) ⇒ Object



78
79
80
# File 'lib/motion_record/scope_helpers.rb', line 78

def limit(limit_value)
  scoped.limit(limit_value)
end

#maximum(column) ⇒ Object



52
53
54
# File 'lib/motion_record/scope_helpers.rb', line 52

def maximum(column)
  scoped.maximum(column)
end

#minimum(column) ⇒ Object



56
57
58
# File 'lib/motion_record/scope_helpers.rb', line 56

def minimum(column)
  scoped.minimum(column)
end

#order(ordering_term) ⇒ Object



74
75
76
# File 'lib/motion_record/scope_helpers.rb', line 74

def order(ordering_term)
  scoped.order(ordering_term)
end

#pluck(attribute) ⇒ Object



32
33
34
# File 'lib/motion_record/scope_helpers.rb', line 32

def pluck(attribute)
  scoped.pluck(attribute)
end

#sum(column) ⇒ Object



60
61
62
# File 'lib/motion_record/scope_helpers.rb', line 60

def sum(column)
  scoped.sum(column)
end

#update_all(params) ⇒ Object

Persistence queries



38
39
40
# File 'lib/motion_record/scope_helpers.rb', line 38

def update_all(params)
  scoped.update_all(params)
end

#where(conditions = {}) ⇒ Object

Scope building



70
71
72
# File 'lib/motion_record/scope_helpers.rb', line 70

def where(conditions={})
  scoped.where(conditions)
end