Skip to content

Commit

Permalink
Merge pull request #13561 from robin850/issue-11723
Browse files Browse the repository at this point in the history
Avoid raising a NameError on FreeBSD using Date
  • Loading branch information
rafaelfranca committed Jan 1, 2014
2 parents 224d3a6 + afc98ea commit 3e1e36b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions activesupport/CHANGELOG.md
@@ -1,3 +1,8 @@
* Use `remove_possible_method` instead of `remove_method` to avoid
a `NameError` to be thrown on FreeBSD with the `Date` object.

*Rafael Mendonça França*, *Robin Dupret*

* `blank?` and `present?` commit to return singletons.

*Xavier Noria*, *Pavel Pravosud*
Expand Down
7 changes: 5 additions & 2 deletions activesupport/lib/active_support/core_ext/date/conversions.rb
@@ -1,6 +1,7 @@
require 'date'
require 'active_support/inflector/methods'
require 'active_support/core_ext/date/zones'
require 'active_support/core_ext/module/remove_method'

class Date
DATE_FORMATS = {
Expand All @@ -19,8 +20,10 @@ class Date
# Ruby 1.9 has Date#to_time which converts to localtime only.
remove_method :to_time

# Ruby 1.9 has Date#xmlschema which converts to a string without the time component.
remove_method :xmlschema
# Ruby 1.9 has Date#xmlschema which converts to a string without the time
# component. This removal may generate an issue on FreeBSD, that's why we
# need to use remove_possible_method here
remove_possible_method :xmlschema

# Convert to a formatted string. See DATE_FORMATS for predefined formats.
#
Expand Down

0 comments on commit 3e1e36b

Please sign in to comment.