Class: Repository::Base
- Inherits:
-
Object
- Object
- Repository::Base
- Defined in:
- lib/repository/base.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#filter ⇒ Object
12 13 14 |
# File 'lib/repository/base.rb', line 12 def filter @filter_factory ||= FilterFactory.new end |
#find ⇒ Object
8 9 10 |
# File 'lib/repository/base.rb', line 8 def find cursor end |
#remove!(model = nil) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/repository/base.rb', line 24 def remove!(model=nil) if model remove_by_id!(model.send(primary_key)) else cursor.remove! end end |
#remove_by_id!(id) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/repository/base.rb', line 16 def remove_by_id!(id) if model = find_by_id(id) remove_model!(model) else raise ArgumentError.new("Could not remove record with id: #{id} because it does not exist") end end |