Module: LazyRecord::BaseModule::ClassMethods
- Defined in:
- lib/lazy_record/base_module.rb
Overview
Class methods provided to all LazyRecord classes
Instance Method Summary collapse
- #all ⇒ Object
- #count ⇒ Object
- #destroy_all ⇒ Object
- #first ⇒ Object
- #last ⇒ Object
- #where(condition = nil, &block) ⇒ Object
Instance Method Details
#all ⇒ Object
72 73 74 |
# File 'lib/lazy_record/base_module.rb', line 72 def all @all ||= Relation.new(model: self) end |
#count ⇒ Object
76 77 78 |
# File 'lib/lazy_record/base_module.rb', line 76 def count all.count end |
#destroy_all ⇒ Object
92 93 94 |
# File 'lib/lazy_record/base_module.rb', line 92 def destroy_all all.send(:clear) end |
#first ⇒ Object
80 81 82 |
# File 'lib/lazy_record/base_module.rb', line 80 def first all.first end |
#last ⇒ Object
84 85 86 |
# File 'lib/lazy_record/base_module.rb', line 84 def last all.last end |
#where(condition = nil, &block) ⇒ Object
88 89 90 |
# File 'lib/lazy_record/base_module.rb', line 88 def where(condition = nil, &block) all.where(condition, &block) end |