aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-12-27 00:42:31 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-12-27 00:42:31 +0000
commitd88e83f211e47a8fa8220c880cf7a7309e552503 (patch)
tree7211227591c65ec9a0dd5627f0dc318691fa662e /activesupport
parentc6d47806bf707b7fea6b2732fd690d1bdd4ac317 (diff)
downloadrails-d88e83f211e47a8fa8220c880cf7a7309e552503.tar.gz
rails-d88e83f211e47a8fa8220c880cf7a7309e552503.tar.bz2
rails-d88e83f211e47a8fa8220c880cf7a7309e552503.zip
False is a reasonable default
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5793 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb b/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
index 31f14be344..683789d853 100644
--- a/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
+++ b/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
@@ -19,7 +19,7 @@ class Module
# attr_accessor_with_default(:element_name) { name.underscore }
#
def attr_accessor_with_default(sym, default = nil, &block)
- raise 'Default value or block required' unless default || block
+ raise 'Default value or block required' unless !default.nil? || block
define_method(sym, block_given? ? block : Proc.new { default })
module_eval(<<-EVAL, __FILE__, __LINE__)
def #{sym}=(value)