Skip to content

Commit

Permalink
Merge pull request #3617 from nebulab/kennyadsl/fix-in_taxons-scope
Browse files Browse the repository at this point in the history
Fix in_taxons scope when taxon is an ActiveRecord::Base
  • Loading branch information
kennyadsl authored May 13, 2020
2 parents 360ef72 + 971a053 commit 43cacf4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/app/models/spree/product/scopes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def get_taxons(*ids_or_records_or_names)
ids_or_records_or_names.flatten.map { |taxon|
case taxon
when Integer then Spree::Taxon.find_by(id: taxon)
when ActiveRecord::Base then t
when ActiveRecord::Base then taxon
when String
Spree::Taxon.find_by(name: taxon) ||
Spree::Taxon.where("#{taxons}.permalink LIKE ? OR #{taxons}.permalink = ?", "%/#{taxon}/", "#{taxon}/").first
Expand Down

0 comments on commit 43cacf4

Please sign in to comment.