app/controllers/spree/api/variants_controller.rb in solidus_api-2.10.5 vs app/controllers/spree/api/variants_controller.rb in solidus_api-2.11.0
- old
+ new
@@ -51,26 +51,26 @@
end
private
def product
- @product ||= Spree::Product.accessible_by(current_ability, :read).friendly.find(params[:product_id]) if params[:product_id]
+ @product ||= Spree::Product.accessible_by(current_ability, :show).friendly.find(params[:product_id]) if params[:product_id]
end
def scope
if @product
variants = @product.variants_including_master
else
variants = Spree::Variant
end
if current_ability.can?(:manage, Variant) && params[:show_deleted]
- variants = variants.with_deleted
+ variants = variants.with_discarded
end
in_stock_only = ActiveRecord::Type::Boolean.new.cast(params[:in_stock_only])
suppliable_only = ActiveRecord::Type::Boolean.new.cast(params[:suppliable_only])
- variants = variants.accessible_by(current_ability, :read)
+ variants = variants.accessible_by(current_ability)
if in_stock_only || cannot?(:view_out_of_stock, Spree::Variant)
variants = variants.in_stock
elsif suppliable_only
variants = variants.suppliable
end