Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3676674
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:07:40+00:00 2026-05-19T03:07:40+00:00

I have a legacy table with (horrible) column names like LYEAR#2, LYEAR#3 … LYEAR#9

  • 0

I have a legacy table with (horrible) column names like LYEAR#2, LYEAR#3 … LYEAR#9

I setup a model for it named Glamas

If I have:

accounts = Glamas.all
account_mains = accounts.collect(&:ACCOUNT_MAIN)

It breaks with this error:

SyntaxError: compile error
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.3/lib/active_model/attribute_methods.rb:273: syntax error, unexpected kUNDEF, expecting ')'
                    undef :LYEAR#9?
                         ^
/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.3/lib/active_model/attribute_methods.rb:274: syntax error, unexpected kEND, expecting $end
    from /usr/lib/ruby/gems/1.8/gems/activemodel-3.0.3/lib/active_model/attribute_methods.rb:274:in `define_attribute_methods'
    from /usr/lib/ruby/gems/1.8/gems/activemodel-3.0.3/lib/active_model/attribute_methods.rb:262:in `each'
    from /usr/lib/ruby/gems/1.8/gems/activemodel-3.0.3/lib/active_model/attribute_methods.rb:262:in `define_attribute_methods'
from /usr/lib/ruby/gems/1.8/gems/activemodel-3.0.3/lib/active_model/attribute_methods.rb:261:in `each'
from /usr/lib/ruby/gems/1.8/gems/activemodel-3.0.3/lib/active_model/attribute_methods.rb:261:in `define_attribute_methods'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/attribute_methods.rb:13:in `define_attribute_methods'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/attribute_methods.rb:41:in `method_missing'
from (irb):31:in `to_proc'
from (irb):31:in `collect'
from (irb):31
from :0

Is this a problem with activemodel, or is it something that I can fix with something in my code?

This is rails 3 btw.

#glamas.rb
class Glamas < ActiveRecord::Base
  establish_connection "turnkey"
end

and…

#database.yml
turnkey:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: turnkey
  pool: 5
  username: root
  password:
  socket: /var/run/mysqld/mysqld.sock

I am pulling the tables strait over from the legacy machine, I guess (If I absolutely have to) I could rename the columns when I pull them over, but the proess is already a huge pain and processor intensive.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:07:41+00:00Added an answer on May 19, 2026 at 3:07 am

    You’re not going to be able to use these tables with Active Record. AR defines instance methods for your classes which are named the same as the columns and in ruby # isn’t allowed in method names (or any names for that matter as it’s the comment character).

    I’d suggest either creating views in the database with more sensible names or just renaming the columns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to integrate with a Legacy table that has a column named
I have some legacy layouts with nested tables. I'd like the parent table's <td>
i have a legacy db structure like table t1 ( c0 bigint, // pk
I have a legacy object model that has content objects and a table designed
I have the old legacy table called DXFTACCTS, and I created Rails model Account.
I have a legacy SQL schema which looks something like this: CREATE TABLE `User`
I have following legacy database setup: CREATE TABLE `categories` ( `id` int(11) NOT NULL
I have a legacy table, which I can't change. The values in it can
I have a table which has essentially boolean values in a legacy database. The
I have a table that contains the stock. It's legacy database and the stock

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.