Class: Grime::ApiController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Grime::ApiController
- Defined in:
- app/controllers/grime/api_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/controllers/grime/api_controller.rb', line 16 def create ActiveRecord::Base.transaction do @object = scope.create @object.update_attributes!(params[params_key]) end render json: @object end |
#destroy ⇒ Object
29 30 31 |
# File 'app/controllers/grime/api_controller.rb', line 29 def destroy render json: @object.destroy! end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/grime/api_controller.rb', line 8 def index render json: scope.all end |
#show ⇒ Object
12 13 14 |
# File 'app/controllers/grime/api_controller.rb', line 12 def show render json: @object end |
#update ⇒ Object
24 25 26 27 |
# File 'app/controllers/grime/api_controller.rb', line 24 def update @object.update!(params[params_key]) render json: @object end |