diff options
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/tasks/sqlite_rake_test.rb | 8 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/attribute.rb | 9 |
3 files changed, 9 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 05715feb97..edf82eb170 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -941,7 +941,8 @@ module ActiveRecord # # The <tt>:dependent</tt> option can have different values which specify how the deletion # is done. For more information, see the documentation for this option on the different - # specific association types. + # specific association types. When no option is given, the behaviour is to do nothing + # with the associated records when destroying a record. # # === Delete or destroy? # diff --git a/activerecord/test/cases/tasks/sqlite_rake_test.rb b/activerecord/test/cases/tasks/sqlite_rake_test.rb index 06a1d0ffc2..7209c0f14d 100644 --- a/activerecord/test/cases/tasks/sqlite_rake_test.rb +++ b/activerecord/test/cases/tasks/sqlite_rake_test.rb @@ -162,8 +162,8 @@ module ActiveRecord assert File.exists?(dbfile) assert File.exists?(filename) ensure - FileUtils.rm(filename) - FileUtils.rm(dbfile) + FileUtils.rm_f(filename) + FileUtils.rm_f(dbfile) end end @@ -184,8 +184,8 @@ module ActiveRecord ActiveRecord::Tasks::DatabaseTasks.structure_load @configuration, filename, '/rails/root' assert File.exists?(dbfile) ensure - FileUtils.rm(filename) - FileUtils.rm(dbfile) + FileUtils.rm_f(filename) + FileUtils.rm_f(dbfile) end end end diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index 7b6f8ab0a1..da0a12136c 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -79,14 +79,12 @@ class Class def self.#{name}=(val) singleton_class.class_eval do - remove_possible_method(:#{name}) - define_method(:#{name}) { val } + redefine_method(:#{name}) { val } end if singleton_class? class_eval do - remove_possible_method(:#{name}) - def #{name} + redefine_method(:#{name}) do defined?(@#{name}) ? @#{name} : singleton_class.#{name} end end @@ -95,8 +93,7 @@ class Class end if instance_reader - remove_possible_method :#{name} - def #{name} + redefine_method(:#{name}) do defined?(@#{name}) ? @#{name} : self.class.#{name} end |