diff options
Diffstat (limited to 'activerecord/test/models/post.rb')
-rw-r--r-- | activerecord/test/models/post.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index b5f9328139..939df7549b 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -1,8 +1,8 @@ class Post < ActiveRecord::Base - named_scope :containing_the_letter_a, where("body LIKE '%a%'") - named_scope :ranked_by_comments, order("comments_count DESC") - named_scope :limit_by, lambda {|l| limit(l) } - named_scope :with_authors_at_address, lambda { |address| { + scope :containing_the_letter_a, where("body LIKE '%a%'") + scope :ranked_by_comments, order("comments_count DESC") + scope :limit_by, lambda {|l| limit(l) } + scope :with_authors_at_address, lambda { |address| { :conditions => [ 'authors.author_address_id = ?', address.id ], :joins => 'JOIN authors ON authors.id = posts.author_id' } @@ -19,9 +19,9 @@ class Post < ActiveRecord::Base has_one :last_comment, :class_name => 'Comment', :order => 'id desc' - named_scope :with_special_comments, :joins => :comments, :conditions => {:comments => {:type => 'SpecialComment'} } - named_scope :with_very_special_comments, joins(:comments).where(:comments => {:type => 'VerySpecialComment'}) - named_scope :with_post, lambda {|post_id| + scope :with_special_comments, :joins => :comments, :conditions => {:comments => {:type => 'SpecialComment'} } + scope :with_very_special_comments, joins(:comments).where(:comments => {:type => 'VerySpecialComment'}) + scope :with_post, lambda {|post_id| { :joins => :comments, :conditions => {:comments => {:post_id => post_id} } } } |