sqlite3 - How to convert an existing sqllite database into a Rails one? -


i have sqlite3 database 3 tables has id column primary key, has no created_at or update_at columns.

i want use in rails3 applications. how can convert 'rails database'?

it sounds want single rails app access 2 different databases? need 2 things:

  • you need have app connect 2 different databases. "real" database , sqlite3 db
  • after can connect both dbs, may need setup models , override of default rails naming conventions.

for first item, can follow this: connecting rails 3.1 multiple databases

for second item, if tables don't follow railsy way of naming them, can create model looks this:

# app/models/foo.rb class foo < activerecord::base   establish_connection "your_sqlite_connection_name_#{rails.env}"   self.table_name = "name_of_table_in_sqlite_db" end 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -