Skip to content

Commit

Permalink
Fix: List attributes to allow to search for SharedArticles
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
kidhab committed Sep 3, 2024
1 parent cd3141c commit a60521d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/shared_article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a60521d

Please sign in to comment.