Class: Spree::Api::CustomerReturnsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Spree::Api::CustomerReturnsController
- Defined in:
- app/controllers/spree/api/customer_returns_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/spree/api/customer_returns_controller.rb', line 12 def create :create, CustomerReturn if @customer_return.save respond_with(@customer_return, status: 201, default_template: :show) else invalid_resource!(@customer_return) end end |
#index ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/spree/api/customer_returns_controller.rb', line 22 def index :index, CustomerReturn @customer_returns = @order. customer_returns. accessible_by(current_ability). ransack(params[:q]). result @customer_returns = paginate(@customer_returns) respond_with(@customer_returns) end |
#new ⇒ Object
36 37 38 |
# File 'app/controllers/spree/api/customer_returns_controller.rb', line 36 def new :new, CustomerReturn end |
#show ⇒ Object
40 41 42 43 44 |
# File 'app/controllers/spree/api/customer_returns_controller.rb', line 40 def show :show, CustomerReturn @customer_return = @order.customer_returns.accessible_by(current_ability, :show).find(params[:id]) respond_with(@customer_return) end |
#update ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/spree/api/customer_returns_controller.rb', line 46 def update :update, CustomerReturn @customer_return = @order.customer_returns.accessible_by(current_ability, :update).find(params[:id]) if @customer_return.update(customer_return_params) respond_with(@customer_return.reload, default_template: :show) else invalid_resource!(@customer_return) end end |