Commit 415c307cf50ad835a0790a9d962b4298c4127cca
1 parent
c4e8c606
Exists in
staging
and in
42 other branches
s/named_scope/scope/
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
app/models/category.rb
| @@ -20,13 +20,13 @@ class Category < ActiveRecord::Base | @@ -20,13 +20,13 @@ class Category < ActiveRecord::Base | ||
| 20 | {:conditions => ['parent_id is null and environment_id = ?', environment.id ]} | 20 | {:conditions => ['parent_id is null and environment_id = ?', environment.id ]} |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | - named_scope :on_level, lambda { |parent| {:conditions => {:parent_id => parent}} } | 23 | + scope :on_level, lambda { |parent| {:conditions => {:parent_id => parent}} } |
| 24 | 24 | ||
| 25 | - named_scope :sub_categories, lambda { |category| | 25 | + scope :sub_categories, lambda { |category| |
| 26 | {:conditions => ['categories.path LIKE ? AND categories.id != ?', "%#{category.slug}%", category.id]} | 26 | {:conditions => ['categories.path LIKE ? AND categories.id != ?', "%#{category.slug}%", category.id]} |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | - named_scope :sub_tree, lambda { |category| | 29 | + scope :sub_tree, lambda { |category| |
| 30 | {:conditions => ['categories.path LIKE ?', "%#{category.slug}%"]} | 30 | {:conditions => ['categories.path LIKE ?', "%#{category.slug}%"]} |
| 31 | } | 31 | } |
| 32 | 32 |
app/models/product.rb
| @@ -38,7 +38,7 @@ class Product < ActiveRecord::Base | @@ -38,7 +38,7 @@ class Product < ActiveRecord::Base | ||
| 38 | 38 | ||
| 39 | scope :more_recent, :order => "created_at DESC" | 39 | scope :more_recent, :order => "created_at DESC" |
| 40 | 40 | ||
| 41 | - named_scope :from_category, lambda { |category| | 41 | + scope :from_category, lambda { |category| |
| 42 | {:joins => :product_category, :conditions => ['categories.path LIKE ?', "%#{category.slug}%"]} if category | 42 | {:joins => :product_category, :conditions => ['categories.path LIKE ?', "%#{category.slug}%"]} if category |
| 43 | } | 43 | } |
| 44 | 44 |