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
61 62 63 |
# File 'lib/layers/orm/providers/sequel.rb', line 61 def all model.all end |
#create ⇒ Object
69 70 71 |
# File 'lib/layers/orm/providers/sequel.rb', line 69 def create model.create( attributes.to_hash ) end |
#delete(name) ⇒ Object
73 74 75 |
# File 'lib/layers/orm/providers/sequel.rb', line 73 def delete( name ) find( name ).destroy end |
#find(name) ⇒ Object
65 66 67 |
# File 'lib/layers/orm/providers/sequel.rb', line 65 def find( name ) model[ :name => name ] or not_found end |
#update(name) ⇒ Object
77 78 79 80 81 |
# File 'lib/layers/orm/providers/sequel.rb', line 77 def update( name ) instance = find( name ) instance.update_with_params( attributes.to_hash ) instance end |