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