diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-08-27 20:00:14 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-08-27 20:00:14 -0300 |
commit | f2c0725d79e29b02e30e7a4827851acc4a766730 (patch) | |
tree | e1965017c90c55511a80cebe15f8eb21485aaefe /activerecord/lib/active_record | |
parent | 7cce95b25ace33e04526d4490e487a080c1f9b96 (diff) | |
download | rails-f2c0725d79e29b02e30e7a4827851acc4a766730.tar.gz rails-f2c0725d79e29b02e30e7a4827851acc4a766730.tar.bz2 rails-f2c0725d79e29b02e30e7a4827851acc4a766730.zip |
Revert "Add readonly support for relations."
This reverts commit 7cce95b25ace33e04526d4490e487a080c1f9b96.
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 7 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 12 |
2 files changed, 2 insertions, 17 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 402d68c36e..c11c049415 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1722,7 +1722,7 @@ module ActiveRecord #:nodoc: def construct_finder_arel(options = {}, scope = scope(:find)) # TODO add lock to Arel - relation = arel_table(options[:from]). + arel_table(options[:from]). joins(construct_join(options[:joins], scope)). conditions(construct_conditions(options[:conditions], scope)). select(options[:select] || (scope && scope[:select]) || default_select(options[:joins] || (scope && scope[:joins]))). @@ -1730,11 +1730,6 @@ module ActiveRecord #:nodoc: order(construct_order(options[:order], scope)). limit(construct_limit(options[:limit], scope)). offset(construct_offset(options[:offset], scope)) - - relation = relation.readonly if options[:readonly] - - relation - end def construct_finder_sql(options, scope = scope(:find)) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 4b53857d36..570ba3f80d 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -5,20 +5,10 @@ module ActiveRecord def initialize(klass, relation) @klass, @relation = klass, relation - @readonly = false - end - - def readonly - @readonly = true - self end def to_a - records = @klass.find_by_sql(@relation.to_sql) - - records.each { |record| record.readonly! } if @readonly - - records + @klass.find_by_sql(@relation.to_sql) end def each(&block) |