Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix 5818 #87

Closed
wants to merge 1 commit into from

2 participants

@josevalim
Owner

Do we really need to use symbols? Couldn't they simply be strings?

Nope.

ruby-1.9.2-head >   module A
ruby-1.9.2-head ?>  def a
ruby-1.9.2-head ?>    end
ruby-1.9.2-head ?>  undef :a
ruby-1.9.2-head ?>  end

ruby-1.9.2-head > module B
ruby-1.9.2-head ?>  def b
ruby-1.9.2-head ?>    end
ruby-1.9.2-head ?>  undef 'b'
ruby-1.9.2-head ?>  end
SyntaxError: (irb):54: syntax error, unexpected tSTRING_BEG
undef 'b'

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 24, 2010
  1. @paneq
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 5 deletions.
  1. +5 −5 activemodel/lib/active_model/attribute_methods.rb
View
10 activemodel/lib/active_model/attribute_methods.rb
@@ -98,10 +98,10 @@ module ClassMethods
def define_attr_method(name, value=nil, &block)
sing = singleton_class
sing.class_eval <<-eorb, __FILE__, __LINE__ + 1
- if method_defined?(:original_#{name})
- undef :original_#{name}
+ if method_defined?(:'original_#{name}')
+ undef :'original_#{name}'
end
- alias_method :original_#{name}, :#{name}
+ alias_method :'original_#{name}', :'#{name}'
eorb
if block_given?
sing.send :define_method, name, &block
@@ -274,8 +274,8 @@ def define_attribute_methods(attr_names)
method_name = matcher.method_name(attr_name)
generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1
- if method_defined?(:#{method_name})
- undef :#{method_name}
+ if method_defined?(:'#{method_name}')
+ undef :'#{method_name}'
end
def #{method_name}(*args)
send(:#{matcher.method_missing_target}, '#{attr_name}', *args)
Something went wrong with that request. Please try again.