Class: Husky::Repo::ActiveRecord
- Inherits:
-
Object
- Object
- Husky::Repo::ActiveRecord
- Defined in:
- lib/husky/repo.rb
Instance Method Summary collapse
- #all ⇒ Object
-
#build(attributes) ⇒ Object
DEPRECATE.
- #create(attributes) ⇒ Object
- #destroy(item) ⇒ Object
- #find(id) ⇒ Object
- #new(attributes = {}) ⇒ Object
- #save(item) ⇒ Object
- #update(item, attributes) ⇒ Object
Instance Method Details
#all ⇒ Object
7 8 9 |
# File 'lib/husky/repo.rb', line 7 def all entity.wrap(data_source.all) end |
#build(attributes) ⇒ Object
DEPRECATE
20 21 22 |
# File 'lib/husky/repo.rb', line 20 def build(attributes) entity.build(data_source.build(attributes)) end |
#create(attributes) ⇒ Object
28 29 30 |
# File 'lib/husky/repo.rb', line 28 def create(attributes) entity.build(data_source.create(attributes)) end |
#destroy(item) ⇒ Object
36 37 38 |
# File 'lib/husky/repo.rb', line 36 def destroy(item) item.destroy end |
#find(id) ⇒ Object
11 12 13 |
# File 'lib/husky/repo.rb', line 11 def find(id) entity.build(data_source.find(id)) end |
#new(attributes = {}) ⇒ Object
15 16 17 |
# File 'lib/husky/repo.rb', line 15 def new(attributes = {}) entity.build(data_source.new(attributes)) end |
#save(item) ⇒ Object
24 25 26 |
# File 'lib/husky/repo.rb', line 24 def save(item) item.save end |
#update(item, attributes) ⇒ Object
32 33 34 |
# File 'lib/husky/repo.rb', line 32 def update(item, attributes) entity.build(item.update_attributes(attributes)) end |