This project is archived and is in readonly mode.

#5818 ✓resolved
Brian Ploetz

'#' character in column name causes ActiveModel error

Reported by Brian Ploetz | October 15th, 2010 @ 10:33 PM | in 3.0.2

I have an Oracle table which has the following column (legal in Oracle):


Note the '#' character. I have this table mapped to a model class via ActiveRecord. This column name causes the following error whenever you try to use this model:

1) Case should be valid with valid attributes

 /Users/bploetz/.rvm/gems/ruby-1.9.2-p0@sw-model/gems/activemodel-3.0.0/lib/active_model/attribute_methods.rb:273: syntax error, unexpected keyword_undef, expecting ')'
                     undef :case#?
 /Users/bploetz/.rvm/gems/ruby-1.9.2-p0@sw-model/gems/activemodel-3.0.0/lib/active_model/attribute_methods.rb:274: syntax error, unexpected keyword_end, expecting $end

This comes from the following in active_model/attribute_methods.rb:

if method_defined?(:#{method_name})
undef :#{method_name} end

These evaluate to :case#, which is not a valid symbol.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Referenced by