Skip to content

Commit

Permalink
Cleanup taxon promotion rule
Browse files Browse the repository at this point in the history
Removes use of inject and unused variables
  • Loading branch information
jhawthorn committed Feb 16, 2016
1 parent 339cc85 commit 932acf3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/app/models/spree/promotion/rules/taxon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def order_taxons(order)

# ids of taxons rules and taxons rules children
def taxons_including_children_ids
taxons.inject([]){ |ids, taxon| ids += taxon.self_and_descendants.ids }
taxons.flat_map { |taxon| taxon.self_and_descendants.ids }
end

# taxons order vs taxons rules and taxons rules children
Expand All @@ -58,7 +58,7 @@ def order_taxons_in_taxons_and_children(order)
end

def taxons_in_order_including_parents(order)
order_taxons_in_taxons_and_children(order).inject([]){ |taxons, taxon| taxons << taxon.self_and_ancestors }.flatten.uniq
order_taxons_in_taxons_and_children(order).flat_map(&:self_and_ancestors).uniq
end

def taxon_product_ids
Expand Down

0 comments on commit 932acf3

Please sign in to comment.