Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding a reader for loaded, initializing @loaded to false

  • Loading branch information...
commit e1df4b956882f0c10a310088c1c13dcaa655a3b1 1 parent 9df9c4b
@tenderlove tenderlove authored
View
2  activerecord/lib/active_record/named_scope.rb
@@ -26,7 +26,7 @@ module ClassMethods
# You can define a \scope that applies to all finders using
# ActiveRecord::Base.default_scope.
def scoped(options = nil)
- if options.present?
+ if options
scoped.apply_finder_options(options)
else
current_scoped_methods ? relation.merge(current_scoped_methods) : relation.clone
View
9 activerecord/lib/active_record/relation.rb
@@ -13,14 +13,15 @@ class Relation
delegate :to_xml, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a
delegate :insert, :to => :arel
- attr_reader :table, :klass
+ attr_reader :table, :klass, :loaded
attr_accessor :extensions
+ alias :loaded? :loaded
def initialize(klass, table)
@klass, @table = klass, table
@implicit_readonly = nil
- @loaded = nil
+ @loaded = false
SINGLE_VALUE_METHODS.each {|v| instance_variable_set(:"@#{v}_value", nil)}
(ASSOCIATION_METHODS + MULTI_VALUE_METHODS).each {|v| instance_variable_set(:"@#{v}_values", [])}
@@ -292,10 +293,6 @@ def delete(id_or_array)
where(@klass.primary_key => id_or_array).delete_all
end
- def loaded?
- @loaded
- end
-
def reload
reset
to_a # force reload
Please sign in to comment.
Something went wrong with that request. Please try again.