Module: Waves::Layers::ORM::Sequel::ControllerMethods
- Defined in:
- lib/layers/orm/providers/sequel.rb
Overview
Mixed into Waves::Controllers::Base. Provides ORM-specific helper methods for model access.
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
64 65 66 |
# File 'lib/layers/orm/providers/sequel.rb', line 64 def all model.all end |
#create ⇒ Object
72 73 74 |
# File 'lib/layers/orm/providers/sequel.rb', line 72 def create model.create( attributes.to_hash ) end |
#delete(name) ⇒ Object
76 77 78 |
# File 'lib/layers/orm/providers/sequel.rb', line 76 def delete( name ) find( name ).destroy end |
#find(name) ⇒ Object
68 69 70 |
# File 'lib/layers/orm/providers/sequel.rb', line 68 def find( name ) model[ :name => name ] or not_found end |
#update(name) ⇒ Object
80 81 82 83 84 |
# File 'lib/layers/orm/providers/sequel.rb', line 80 def update( name ) instance = find( name ) instance.update_with_params( attributes.to_hash ) instance end |