diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-10 17:03:10 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-10 17:03:10 -0300 |
commit | 167e6dacafe60f85b3f176e3d1dfa774699cf747 (patch) | |
tree | 98c66825e690cd83d17d460f3dd727f586b02e7b | |
parent | 1938c9646b7edcae88817a9b3b0e5d8b897ecc77 (diff) | |
parent | 8c1406cf256c0140748c98cd3c533afc504e0007 (diff) | |
download | rails-167e6dacafe60f85b3f176e3d1dfa774699cf747.tar.gz rails-167e6dacafe60f85b3f176e3d1dfa774699cf747.tar.bz2 rails-167e6dacafe60f85b3f176e3d1dfa774699cf747.zip |
Merge pull request #14695 from akshay-vishnoi/doc_changes
[ci skip] Remove false documentation
-rw-r--r-- | guides/source/active_support_core_extensions.md | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 5698dc0413..f08a85770f 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -964,20 +964,7 @@ NOTE: Defined in `active_support/core_ext/module/delegation.rb` There are cases where you need to define a method with `define_method`, but don't know whether a method with that name already exists. If it does, a warning is issued if they are enabled. No big deal, but not clean either. -The method `redefine_method` prevents such a potential warning, removing the existing method before if needed. Rails uses it in a few places, for instance when it generates an association's API: - -```ruby -redefine_method("#{reflection.name}=") do |new_value| - association = association_instance_get(reflection.name) - - if association.nil? || association.target != new_value - association = association_proxy_class.new(self, reflection) - end - - association.replace(new_value) - association_instance_set(reflection.name, new_value.nil? ? nil : association) -end -``` +The method `redefine_method` prevents such a potential warning, removing the existing method before if needed. NOTE: Defined in `active_support/core_ext/module/remove_method.rb` |