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

  • SEARCH
  • Home
  • 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 7556651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:54:51+00:00 2026-05-30T11:54:51+00:00

I’ve got a legacy database that I’m connecting to via the sqlserver adapter. One

  • 0

I’ve got a legacy database that I’m connecting to via the sqlserver adapter. One of the databases is called “SiteIndex_Players”. I’ve generated the following model:

class SiteIndexPlayer < ActiveRecord::Base
  set_table_name = "SiteIndex_Players"
end

I’ve also tried:

class SiteIndexPlayer < ActiveRecord::Base
  table_name = "SiteIndex_Players"
end

Both ways, when I run the rails console rails c, I get this:

1.9.2-p290 :001 > SiteIndexPlayer.first
SiteIndexPlayer Load (352.1ms)  EXEC sp_executesql N'SELECT TOP (1) [site_index_players].*    FROM [site_index_players]'
ActiveRecord::StatementInvalid: TinyTds::Error: Invalid object name 'site_index_players'.: EXEC sp_executesql N'SELECT TOP (1) [site_index_players].* FROM [site_index_players]'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:412:in `each'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:412:in `handle_to_names_and_values_dblib'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:401:in `handle_to_names_and_values'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:373:in `_raw_select'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:367:in `block in raw_select'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:367:in `raw_select'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:350:in `do_exec_query'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:24:in `exec_query'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.2.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:293:in `select'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:16:in `select_all'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/querying.rb:38:in `block in find_by_sql'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/explain.rb:40:in `logging_query_plan'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/querying.rb:37:in `find_by_sql'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/relation.rb:170:in `exec_queries'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/relation.rb:159:in `block in to_a'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/explain.rb:33:in `logging_query_plan'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/relation.rb:158:in `to_a'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/relation/finder_methods.rb:377:in `find_first'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/relation/finder_methods.rb:122:in `first'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/querying.rb:5:in `first'
from (irb):1
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in `start'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in `start'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.2-p290 :002 > 

Makes sense, the table is “SiteIndex_Players”, not “site_index_players” (notice the missing underscore).

Is there a way I can define the table to have the name “SiteIndex_Players”?

Thanks

  • 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-30T11:54:53+00:00Added an answer on May 30, 2026 at 11:54 am

    Instead of

    set_table_name = "SiteIndex_Players"

    you need

    set_table_name "SiteIndex_Players"

    without the equals sign.

    See: http://apidock.com/rails/ActiveRecord/Base/set_table_name/class

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
i got an object with contents of html markup in it, for example: string
I need a function that will clean a strings' special characters. I do NOT

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.