On Sun, Sep 11, 2011 at 9:09 PM, Derek Seymour <dzseymour / gmail.com> wrote:

> Can't find the table which I know exists in the database connection
> given...
>
>
>
>
> require 'csv'
> require 'rubygems'
> require 'sqlite3'
> require 'active_record'
>
>
> # connect to database.  This will create one if it doesn't exist
> MY_DB_NAME = "development.sqlite3"
> MY_DB = SQLite3::Database.new(MY_DB_NAME)
>
> # get active record set up
> ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database
> => MY_DB_NAME)
>
>
> #this prints out false, even though I know it exists!!!!!
>
> puts ActiveRecord::Base.connection.table_exists?("Users")
>
>
>
>
> # get access to a user record (in theory)
> class User < ActiveRecord::Base
>
>  end
>
>
>
> #spits the dummy on this line cos it doesn't know what the table is
>
> puts User.count
>
> --
> Posted via http://www.ruby-forum.com/.
>
>

First thought is that you should give the full path to the database.