Module: Waves::Layers::ORM::ActiveRecord::ControllerMethods
- Defined in:
- lib/layers/orm/providers/active_record.rb
Overview
Mixed into Waves::Controllers::Base. Provides ORM-specific helper methods for model access.
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
60 61 62 |
# File 'lib/layers/orm/providers/active_record.rb', line 60 def all model.find(:all) end |
#create ⇒ Object
68 69 70 |
# File 'lib/layers/orm/providers/active_record.rb', line 68 def create model.create( attributes ) end |
#delete(name) ⇒ Object
72 73 74 |
# File 'lib/layers/orm/providers/active_record.rb', line 72 def delete( name ) find( name ).destroy end |
#find(name) ⇒ Object
64 65 66 |
# File 'lib/layers/orm/providers/active_record.rb', line 64 def find( name ) model.find_by_name(name) or not_found end |
#update(name) ⇒ Object
76 77 78 79 80 |
# File 'lib/layers/orm/providers/active_record.rb', line 76 def update( name ) instance = find( name ) instance.update_attributes( attributes ) instance end |