database name

45 views
Skip to first unread message

loveand light

unread,
Apr 5, 2017, 2:41:54 PM4/5/17
to sqlite3-ruby
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
Reply all
Reply to author
Forward
0 new messages