app/controllers/spree/api/v1/properties_controller.rb in spree_api-3.7.14.1 vs app/controllers/spree/api/v1/properties_controller.rb in spree_api-4.0.0.beta

- old
+ new

@@ -3,11 +3,11 @@ module V1 class PropertiesController < Spree::Api::BaseController before_action :find_property, only: [:show, :update, :destroy] def index - @properties = Spree::Property.accessible_by(current_ability, :read) + @properties = Spree::Property.accessible_by(current_ability) @properties = if params[:ids] @properties.where(id: params[:ids].split(',').flatten) else @properties.ransack(params[:q]).result @@ -34,11 +34,11 @@ end def update if @property authorize! :update, @property - @property.update_attributes(property_params) + @property.update(property_params) respond_with(@property, status: 200, default_template: :show) else invalid_resource!(@property) end end @@ -54,12 +54,12 @@ end private def find_property - @property = Spree::Property.accessible_by(current_ability, :read).find(params[:id]) + @property = Spree::Property.accessible_by(current_ability, :show).find(params[:id]) rescue ActiveRecord::RecordNotFound - @property = Spree::Property.accessible_by(current_ability, :read).find_by!(name: params[:id]) + @property = Spree::Property.accessible_by(current_ability, :show).find_by!(name: params[:id]) end def property_params params.require(:property).permit(permitted_property_attributes) end