Forum: Ruby Mysql::Error Table doesn't exist

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
9cce4cca531f835e951309aa39bb421b?d=identicon&s=25 Michael Furmaniuk (mfurmaniuk)
on 2009-04-07 17:38
I installed the Windows mysql gem, I'm using MySQL on Windows, and have
been able to get the connection to work but am having trouble figuring
out what is happening with my query.  What I have is (with non-essential
parts stripped out):

    require 'active_record'

    # Database connection
        dbconfig = YAML::load('../conf/database.yml'))
        puts $!

    class TestResults < ActiveRecord::Base

    io.puts "What Agents do you want to see?\n"
    io.print "Agent Name = "
    my_agent = io.gets.chomp
    io.puts "Looking for #{my_agent}\n"
        agents = TestResults.first()
        io.puts %{Found #{agents.testname} - #{agents.status}}
        puts $!

When I run interactively I can enter my Agent name but all I see then
Mysql::Error: Table 'auto_harness_development.test_results' doesn't
exist: SELECT * FROM `test_results`  LIMIT 1

I don't understand why test_results is getting appended to the table
name, or why its being inserted into the select statement as the table
name, is there a configuration parameter I need to set or am I just
misusing the query?
9cce4cca531f835e951309aa39bb421b?d=identicon&s=25 Michael Furmaniuk (mfurmaniuk)
on 2009-04-08 19:40
So, I ended up taking another look at this today and realized I hadn't
been paying as much attention to the naming as I would in Rails.

>     class TestResults < ActiveRecord::Base
    class AutoHarnesses < ActiveRecord::Base


>         agents = TestResults.first()
    agents = AutoHarnesses.first()

I get my query to complete, I didn't realize ActiveRecord here was also
using the same naming standards as it does within Rails, but I should
have expected that since the access methods seem to be the same.
This topic is locked and can not be replied to.