11200: rename products scope

This commit is contained in:
Ahmed Ejaz
2024-09-11 11:54:38 +05:00
parent 76fdf3725a
commit 5be53a40a9
2 changed files with 2 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ module Admin
# if user hasn't saved any preferences on products page and there's only one producer;
# we need to hide producer column
def hide_producer_column?(producer_options)
spree_current_user.column_preferences.products.empty? && producer_options.one?
spree_current_user.column_preferences.bulk_edit_product.empty? && producer_options.one?
end
end
end

View File

@@ -15,7 +15,7 @@ class ColumnPreference < ApplicationRecord
validates :column_name, presence: true, inclusion: { in: proc { |p|
valid_columns_for(p.action_name)
} }
scope :products, -> { where(action_name: 'products_v3_index') }
scope :bulk_edit_product, -> { where(action_name: 'products_v3_index') }
def self.for(user, action_name)
stored_preferences = where(user_id: user.id, action_name:)