From a60521d37fd9196c201f423bdb502d4ce0d9e02e Mon Sep 17 00:00:00 2001 From: kidhab <32387157+kidhab@users.noreply.github.com> Date: Wed, 21 Aug 2024 16:32:39 +0200 Subject: [PATCH] Fix: List attributes to allow to search for SharedArticles Without this list the application throws an error message if one tries to search for articles to import from a shared suppliers. From the error message: `Ransack needs SharedArticle attributes explicitly allowlisted as searchable` --- app/models/shared_article.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/shared_article.rb b/app/models/shared_article.rb index c390a0210..66ff2b88f 100644 --- a/app/models/shared_article.rb +++ b/app/models/shared_article.rb @@ -6,6 +6,10 @@ class SharedArticle < ApplicationRecord belongs_to :shared_supplier, foreign_key: :supplier_id + def self.ransackable_attributes(_auth_object = nil) + %w[category created_on deposit id manufacturer name note number origin price scale_price scale_quantity supplier_id tax unit unit_quantity updated_on] + end + def build_new_article(supplier) supplier.articles.build( name: name,