Class: Spree::Api::PropertiesController
- Inherits:
- 
      BaseController
      
        - Object
- ActionController::Base
- BaseController
- Spree::Api::PropertiesController
 
- Defined in:
- app/controllers/spree/api/properties_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
| 29 30 31 32 33 34 35 36 37 | # File 'app/controllers/spree/api/properties_controller.rb', line 29 def create :create, Property @property = Spree::Property.new(property_params) if @property.save respond_with(@property, status: 201, default_template: :show) else invalid_resource!(@property) end end | 
#destroy ⇒ Object
| 49 50 51 52 53 54 55 56 57 | # File 'app/controllers/spree/api/properties_controller.rb', line 49 def destroy if @property :destroy, @property @property.destroy respond_with(@property, status: 204) else invalid_resource!(@property) end end | 
#index ⇒ Object
| 8 9 10 11 12 13 14 15 16 17 18 19 20 | # File 'app/controllers/spree/api/properties_controller.rb', line 8 def index @properties = Spree::Property.accessible_by(current_ability) if params[:ids] ids = params[:ids].split(",").flatten @properties = @properties.where(id: ids) else @properties = @properties.ransack(params[:q]).result end @properties = paginate(@properties) respond_with(@properties) end | 
#new ⇒ Object
| 26 27 | # File 'app/controllers/spree/api/properties_controller.rb', line 26 def new end | 
#show ⇒ Object
| 22 23 24 | # File 'app/controllers/spree/api/properties_controller.rb', line 22 def show respond_with(@property) end | 
#update ⇒ Object
| 39 40 41 42 43 44 45 46 47 | # File 'app/controllers/spree/api/properties_controller.rb', line 39 def update if @property :update, @property @property.update(property_params) respond_with(@property, status: 200, default_template: :show) else invalid_resource!(@property) end end |