Commit 484a806c3d1e12d48ea167a60c38b7334c5c2c73

Authored by Rodrigo Souto
1 parent 8d1b1c21

Update named_scope -> scope

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
app/models/product_category.rb
... ... @@ -5,12 +5,12 @@ class ProductCategory < Category
5 5  
6 6 attr_accessible :name, :parent, :environment
7 7  
8   - named_scope :unique, :select => 'DISTINCT ON (path) categories.*'
9   - named_scope :by_enterprise, lambda { |enterprise| {
  8 + scope :unique, :select => 'DISTINCT ON (path) categories.*'
  9 + scope :by_enterprise, lambda { |enterprise| {
10 10 :joins => :products,
11 11 :conditions => ['products.profile_id = ?', enterprise.id]
12 12 }}
13   - named_scope :unique_by_level, lambda { |level| {
  13 + scope :unique_by_level, lambda { |level| {
14 14 :select => "DISTINCT ON (filtered_category) split_part(path, '/', #{level}) AS filtered_category, categories.*"
15 15 }}
16 16  
... ...