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
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
-
#jstree ⇒ Object
Because JSTree wants parameters in a slightly different format.
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 21 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
40 41 42 43 44 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 40 def destroy :destroy, taxonomy taxonomy.destroy respond_with(taxonomy, status: 204) end |
#index ⇒ Object
4 5 6 7 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 4 def index @taxonomies = paginate(taxonomies) respond_with(@taxonomies) end |
#jstree ⇒ Object
Because JSTree wants parameters in a slightly different format
17 18 19 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 17 def jstree show end |
#new ⇒ Object
9 10 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 9 def new end |
#show ⇒ Object
12 13 14 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 12 def show respond_with(taxonomy) end |
#update ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/controllers/spree/api/taxonomies_controller.rb', line 31 def update :update, taxonomy if taxonomy.update_attributes(taxonomy_params) respond_with(taxonomy, status: 200, default_template: :show) else invalid_resource!(taxonomy) end end |