Class: Spree::Api::TaxonomiesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Spree::Api::TaxonomiesController
- Defined in:
- app/controllers/spree/api/taxonomies_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 18 def create :create, Taxonomy @taxonomy = Spree::Taxonomy.new(taxonomy_params) if @taxonomy.save respond_with(@taxonomy, status: 201, default_template: :show) else invalid_resource!(@taxonomy) end end |
#destroy ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 37 def destroy :destroy, taxonomy taxonomy.destroy respond_with(taxonomy, status: 204) end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 6 def index @taxonomies = paginate(taxonomies) respond_with(@taxonomies) end |
#new ⇒ Object
11 12 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 11 def new end |
#show ⇒ Object
14 15 16 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 14 def show respond_with(taxonomy) end |
#update ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 28 def update :update, taxonomy if taxonomy.update(taxonomy_params) respond_with(taxonomy, status: 200, default_template: :show) else invalid_resource!(taxonomy) end end |