connect 2 different sqlite3 databases.

Hi!

I am trying to connect 2 different sqlite3 databases. I can connect them using establish connection, but now I want to join users table to the second sqlite db using a has_many :through in Rails.

I keep getting an exception:

SQLite3::SQLException: no such table: udt_user_links: SELECT "users".* FROM "users" INNER JOIN "udt_user_links" ON "users"."id" = "udt_user_links"."user_id" WHERE "udt_user_links"."user_linkable_id" = ? AND "udt_user_links"."user_linkable_type" = ? AND "udt_user_links"."token" = ?



I am pretty sure what I need to do is set a table_prefix_name to do this like such but my big problem is how to get the name.

def self.table_name_prefix

“main.”

end

I see that one could run the command: PRAGMA database_list; is the sqlite command prompt and get back the name for the current session… but I would need to get both db names dynamically.

Has anyone connected up two databases using a has_many through: like this??

Thanks in advance,

Mark