MySql column names with "-" in them

I am getting warnings in my logs for updates to a table I created that
has column names from an XML response file i get from Google Checkout
notifications. I basically log the orders into a mimicked table.
Column names examples are “total-refund-amount” and so on.

Below are the warnings. Any ideas on how to supress this? my updates
are working. But its a pain to scroll through logs when one order
creates about 300kb of text regarding these warnings.

Has anybody experienced this? found a work-around?

Exception occurred during reader method compilation.
Maybe total-refund-amount is not a valid Ruby identifier?
compile error
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
attribute_methods.rb:160: syntax error, unexpected ‘-’, expecting ‘\n’
or ‘;’
def total-refund-amount; missing_attribute(‘total-refund-amount’,
caller) unless @attributes.has_key?(‘total-refund-amount’);
(v=@attributes[‘total-refund-amount’]) &&
ActiveRecord::ConnectionAdapters::MysqlColumn.value_to_decimal(v); end
^
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
attribute_methods.rb:160: syntax error, unexpected kEND, expecting
$end
def total-refund-amount; missing_attribute(‘total-refund-amount’,
caller) unless @attributes.has_key?(‘total-refund-amount’);
(v=@attributes[‘total-refund-amount’]) &&
ActiveRecord::ConnectionAdapters::MysqlColumn.value_to_decimal(v); end
^
Exception occurred during reader method compilation.
Maybe total-refund-amount is not a valid Ruby identifier?
compile error
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
attribute_methods.rb:160: syntax error, unexpected ‘-’, expecting ‘\n’
or ‘;’
def total-refund-amount=(new_value);write_attribute(‘total-refund-
amount’, new_value);end
^
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
attribute_methods.rb:160: syntax error, unexpected kEND, expecting
$end
def total-refund-amount=(new_value);write_attribute(‘total-refund-
amount’, new_value);end
^
Exception occurred during reader method compilation.
Maybe total-refund-amount is not a valid Ruby identifier?
compile error
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
attribute_methods.rb:160: syntax error, unexpected ‘-’, expecting ‘\n’
or ‘;’
def total-refund-amount?; query_attribute(‘total-refund-amount’); end
^
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
attribute_methods.rb:160: syntax error, unexpected kEND, expecting
$end
def total-refund-amount?; query_attribute(‘total-refund-amount’); end
^

thanks, Ethan

The easiest solution would be to rename your fields with undescores to
follow Rails conventions.

If you need to stuff map easily, a substitution on ‘-’ for ‘_’ is easy
enough to handle in your processing code.

Robby

On Thu, May 29, 2008 at 7:50 AM, Ethan [email protected] wrote:

Has anybody experienced this? found a work-around?
caller) unless @attributes.has_key?(‘total-refund-amount’);
^
attribute_methods.rb:160: syntax error, unexpected kEND, expecting
def total-refund-amount?; query_attribute(‘total-refund-amount’); end


Robby R.
Founder and Executive Director

PLANET ARGON, LLC
Design, Development, and Hosting with Ruby on Rails

http://www.robbyonrails.com/
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]