aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-10-26 15:51:02 +0100
committerJon Leighton <j@jonathanleighton.com>2012-10-26 15:51:02 +0100
commit9e4c41c903e8e58721f2c41776a8c60ddba7a0a9 (patch)
treed580824995d5ea4866b1d976818f3e3d03a02e53 /activerecord/lib/active_record/relation
parenta27b5178d9f1011545ecbf94008c5d890bab25d0 (diff)
downloadrails-9e4c41c903e8e58721f2c41776a8c60ddba7a0a9.tar.gz
rails-9e4c41c903e8e58721f2c41776a8c60ddba7a0a9.tar.bz2
rails-9e4c41c903e8e58721f2c41776a8c60ddba7a0a9.zip
Remove ActiveRecord::Model
In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb2
-rw-r--r--activerecord/lib/active_record/relation/predicate_builder.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index 84aaa39fed..99c2f45bc8 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -159,7 +159,7 @@ module ActiveRecord
# Person.exists?(false)
# Person.exists?
def exists?(conditions = :none)
- conditions = conditions.id if ActiveRecord::Model === conditions
+ conditions = conditions.id if Base === conditions
return false if !conditions
join_dependency = construct_join_dependency_for_association_find
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb
index 71030cb5d7..bd7aeb0c4e 100644
--- a/activerecord/lib/active_record/relation/predicate_builder.rb
+++ b/activerecord/lib/active_record/relation/predicate_builder.rb
@@ -40,7 +40,7 @@ module ActiveRecord
#
# For polymorphic relationships, find the foreign key and type:
# PriceEstimate.where(:estimate_of => treasure)
- if klass && value.class < ActiveRecord::Tag && reflection = klass.reflect_on_association(column.to_sym)
+ if klass && value.class < Base && reflection = klass.reflect_on_association(column.to_sym)
if reflection.polymorphic?
queries << build(table[reflection.foreign_type], value.class.base_class)
end
@@ -67,7 +67,7 @@ module ActiveRecord
def self.build(attribute, value)
case value
when Array, ActiveRecord::Associations::CollectionProxy
- values = value.to_a.map {|x| x.is_a?(ActiveRecord::Model) ? x.id : x}
+ values = value.to_a.map {|x| x.is_a?(Base) ? x.id : x}
ranges, values = values.partition {|v| v.is_a?(Range)}
values_predicate = if values.include?(nil)
@@ -93,7 +93,7 @@ module ActiveRecord
attribute.in(value.arel.ast)
when Range
attribute.in(value)
- when ActiveRecord::Model
+ when ActiveRecord::Base
attribute.eq(value.id)
when Class
# FIXME: I think we need to deprecate this behavior