Topic: Help...Need to connect to External SQLite DB

Hello All...I am back at it again trying to connect to an external DB.  I had to do my project in MVC3 but would like to convert that into RoR.  Can someone give me a quick example on how to connect to an external SQLite db?  Books I have do not demonstrate this option.  Once I see a tutorial and actually do it I am good to go.  I think I am having a hard time because I have been working in another language for a long time.

Update:  I can see that I am connected due to the information returned from localhost:3000

I just need to be able to create the MVC part of it.

Last edited by Lluvain (2012-08-28 14:07:06)

Re: Help...Need to connect to External SQLite DB

You will have to create the models, cobntrollers and views  manually.
You will need to ensure that the existing tables follow Rails expected conventions and if not you will need to override whatever methods to set the non standard settings in your database e.g.

If you have a table called person rails will expect it to b called people so when you create the Person model you will need to set the table name like this

set_table_name 'person'

Hope that is enough to get you started

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: Help...Need to connect to External SQLite DB

Can I get an example if at all possible on something simple on how the view model and controller would look for the code?

This would greatly help me out.

Last edited by Lluvain (2012-08-30 09:19:59)

Re: Help...Need to connect to External SQLite DB

I think the best thing for you to do would be to go through the getting started with rails tutorials.

http://guides.rubyonrails.org/getting_started.html

It's a lot of reading and probably covers some of what you already know but it will benefit you greatly if you can understand everythig that is covered.

Once you have your head round that come back and feel free to ask more questions

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: Help...Need to connect to External SQLite DB

I think that may have just answered my question.  I skimmed through and seen somethings that I needed. I will go through the full tutorial and then back to the book I purchased for more details.  Thanks!

Re: Help...Need to connect to External SQLite DB

Also grab a copy of AWDWR http://pragprog.com/book/rails4/agile-w … with-rails It's a fantastic tutorial and reference book

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)