Module: DefResource::Controller
- Defined in:
- lib/def_resource/controller.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #resource ⇒ Object
- #resources ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 8 |
# File 'lib/def_resource/controller.rb', line 5 def self.included base base.send(:helper_method, :resource) base.send(:before_filter, :def_resource_before_filter) end |
Instance Method Details
#create ⇒ Object
26 27 28 29 |
# File 'lib/def_resource/controller.rb', line 26 def create resource = def_resource.model.create(params[def_resource.param_key]) respond_with resource end |
#destroy ⇒ Object
44 45 46 47 |
# File 'lib/def_resource/controller.rb', line 44 def destroy resource.destroy respond_with resource end |
#edit ⇒ Object
35 36 37 |
# File 'lib/def_resource/controller.rb', line 35 def edit respond_with resource end |
#index ⇒ Object
18 19 20 |
# File 'lib/def_resource/controller.rb', line 18 def index respond_with resources end |
#new ⇒ Object
22 23 24 |
# File 'lib/def_resource/controller.rb', line 22 def new respond_with def_resource.model.new end |
#resource ⇒ Object
10 11 12 |
# File 'lib/def_resource/controller.rb', line 10 def resource @resource ||= def_resource.resource end |
#resources ⇒ Object
14 15 16 |
# File 'lib/def_resource/controller.rb', line 14 def resources @resources ||= def_resource.resources end |
#show ⇒ Object
31 32 33 |
# File 'lib/def_resource/controller.rb', line 31 def show respond_with resource end |
#update ⇒ Object
39 40 41 42 |
# File 'lib/def_resource/controller.rb', line 39 def update resource.update_attributes(params[def_resource.param_key]) respond_with resource end |