From e1a83690da3dc8e72638a71cf6751986338b4596 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 26 Apr 2012 12:03:25 +0100 Subject: remove deprecated scope stuff --- activerecord/test/models/car.rb | 1 - activerecord/test/models/post.rb | 9 +-------- activerecord/test/models/topic.rb | 14 +------------- 3 files changed, 2 insertions(+), 22 deletions(-) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/car.rb b/activerecord/test/models/car.rb index 42ac81690f..b4bc0ad5fa 100644 --- a/activerecord/test/models/car.rb +++ b/activerecord/test/models/car.rb @@ -15,7 +15,6 @@ class Car < ActiveRecord::Base scope :incl_engines, -> { includes(:engines) } scope :order_using_new_style, -> { order('name asc') } - scope :order_using_old_style, -> { { :order => 'name asc' } } end diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index 5002ab9ff8..18810f2de8 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -9,11 +9,6 @@ class Post < ActiveRecord::Base 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' - } - } belongs_to :author do def greeting @@ -32,9 +27,7 @@ class Post < ActiveRecord::Base scope :with_special_comments, -> { joins(:comments).where(: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} } } - } + scope :with_post, ->(post_id) { joins(:comments).where(:comments => { :post_id => post_id }) } has_many :comments do def find_most_recent diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index 0625b8d296..ef9de9669c 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -2,7 +2,7 @@ class Topic < ActiveRecord::Base scope :base, -> { scoped } scope :written_before, lambda { |time| if time - { :conditions => ['written_on < ?', time] } + where 'written_on < ?', time end } scope :approved, -> { where(:approved => true) } @@ -35,18 +35,6 @@ class Topic < ActiveRecord::Base 2 end end - module MultipleExtensionOne - def extension_one - 1 - end - end - module MultipleExtensionTwo - def extension_two - 2 - end - end - scope :named_extension, :extend => NamedExtension - scope :multiple_extensions, :extend => [MultipleExtensionTwo, MultipleExtensionOne] has_many :replies, :dependent => :destroy, :foreign_key => "parent_id" has_many :replies_with_primary_key, :class_name => "Reply", :dependent => :destroy, :primary_key => "title", :foreign_key => "parent_title" -- cgit v1.2.3