diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-03-14 17:43:59 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-15 08:57:41 -0700 |
commit | 5de3698e2be1438d0fdc2b4ef2fe6adf0b94b343 (patch) | |
tree | 261726834da8a92774a49175be3345f7f7a5f93d /activerecord | |
parent | 96bc6bcfee704701de1a9c4c3c6a7c265610d34d (diff) | |
download | rails-5de3698e2be1438d0fdc2b4ef2fe6adf0b94b343.tar.gz rails-5de3698e2be1438d0fdc2b4ef2fe6adf0b94b343.tar.bz2 rails-5de3698e2be1438d0fdc2b4ef2fe6adf0b94b343.zip |
cleaning up many more warnings in activerecord [#4180 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 10 | ||||
-rw-r--r-- | activerecord/lib/active_record/dynamic_finder_match.rb | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 3 |
4 files changed, 17 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 0ce876d7a9..1488d9f967 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1042,6 +1042,9 @@ module ActiveRecord #:nodoc: object.instance_variable_set(:'@attributes', record) object.instance_variable_set(:'@attributes_cache', {}) object.instance_variable_set(:@new_record, false) + object.instance_variable_set(:@readonly, false) + object.instance_variable_set(:@destroyed, false) + object.instance_variable_set(:@marked_for_destruction, false) object.send(:_run_find_callbacks) object.send(:_run_initialize_callbacks) @@ -1508,6 +1511,9 @@ module ActiveRecord #:nodoc: @attributes_cache = {} @new_record = true @readonly = false + @destroyed = false + @marked_for_destruction = false + ensure_proper_type if scope = self.class.send(:current_scoped_methods) @@ -1599,12 +1605,12 @@ module ActiveRecord #:nodoc: # Returns true if this object hasn't been saved yet -- that is, a record for the object doesn't exist yet; otherwise, returns false. def new_record? - @new_record || false + @new_record end # Returns true if this object has been destroyed, otherwise returns false. def destroyed? - @destroyed || false + @destroyed end # Returns if the record is persisted, i.e. it's not a new record and it was not destroyed. diff --git a/activerecord/lib/active_record/dynamic_finder_match.rb b/activerecord/lib/active_record/dynamic_finder_match.rb index 8f9f05ce36..fa7a19487c 100644 --- a/activerecord/lib/active_record/dynamic_finder_match.rb +++ b/activerecord/lib/active_record/dynamic_finder_match.rb @@ -7,6 +7,9 @@ module ActiveRecord def initialize(method) @finder = :first + @bang = false + @instantiator = nil + case method.to_s when /^find_(all_by|last_by|by)_([_a-zA-Z]\w*)$/ @finder = :last if $1 == 'last_by' diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index fd5ffc6d77..5825482db7 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -315,7 +315,9 @@ module ActiveRecord end def announce(message) - text = "#{@version} #{name}: #{message}" + version = defined?(@version) ? @version : nil + + text = "#{version} #{name}: #{message}" length = [0, 75 - text.length].max write "== %s %s" % [text, "=" * length] end diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 3a7ebce288..1a84f70a8e 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -18,6 +18,9 @@ module ActiveRecord @readonly_value = nil @create_with_value = nil @implicit_readonly = nil + @limit_value = nil + @offset_value = nil + @loaded = nil (ASSOCIATION_METHODS + MULTI_VALUE_METHODS).each {|v| instance_variable_set(:"@#{v}_values", [])} end |