I am new to rails development. I have a simple problem but Im stumped and cant find help on google.
I have a sqlite3 database outside of my Rails app. I need to somehow get that data into my app.
What are the options?
Can I
1) somehow import the sqlite3 database and its contents into my rails app? If so what adjustments need to be made, since I know that rails inserts columns into the db: “id”, “created at”, “updated at”
2) If I cannot import the sqlite3 into my rails app, can I read the contents from it and enter the data into my module and then my my db?
Which if these methods is possible and which is suggested?
Could someone please point me to some resources on this topic. What exactly should I be looking for on google for this topic? any keywords?
Also does anyone know of good rails forums that are active?
Thanks,
You can specify a separate connection to that database in your database.yml. Then create a model for a table in that DB. In that model use establish_connection to tell ActiveRecord to get data for that model out of the other DB.
Look at some examples for to_model. This will show you how to transition the data into your new DB.
As far as rails inserting id, created_at and updated_at, this only happens when you use a migration to create a new table. It will not attempt to change any tables from your old DB without you telling it to. In fact, those fields are also optional on new tables.