connect 2 different sqlite3 databases.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

connect 2 different sqlite3 databases.

mark.mcdonald@gmail.com
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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eaf88f13-5bac-4d23-a976-0af719587db3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.