Module: Controller::RestActionsConcern
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/controller/rest_actions_concern.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 22 def create @resource = resource_class.new(permitted_params) @resource.save respond_with @resource, location: collection_path end |
#destroy ⇒ Object
44 45 46 47 48 |
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 44 def destroy @resource = load_resource @resource.destroy respond_with @resource, location: collection_path end |
#edit ⇒ Object
33 34 35 36 |
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 33 def edit @resource = load_resource respond_with @resource end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 12 def index @collection = load_collection respond_with @collection end |
#new ⇒ Object
17 18 19 20 |
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 17 def new @resource = initialize_resource respond_with @resource end |
#show ⇒ Object
28 29 30 31 |
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 28 def show @resource = load_resource respond_with @resource end |
#update ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 38 def update @resource = load_resource @resource.update_attributes(permitted_params) respond_with @resource, location: collection_path end |