Prem Thilagar
2007-Mar-19 20:05 UTC
How to override default DB settings...Connect to remote DB
Hi everyone,
i am pretty much a beginner to Ruby on rails,and i wanted to
develop a complete monitoring system for a grid application using ruby
on rails.But i wanted to override the default settings of the DB
connections with Ruby on rails like the ORM and the plural names based
DB table creations.
This is my problem i already have a full DB stacked with data and i
wanna use the data there,just use there there is going to be no creation
of tables or not even insertions of data.
I tried connecting to the remote db by making changes to the
/config/database.yml and when i ran rake db:migrate,i got some error
messages
i am sure i am doing some thing weird but do not have a idea where to
start debugging from.can some one please suggest me a good point to
start.to understand connecting to an existing remote DB by creating a
new rails application from scratch
I assume this is going to be necessary to override all the naming
conventions in reagard to creation of models and stuff,if some one could
please guide me through this it will be really helpful.
thanks in advance
prem
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Ilan Berci
2007-Mar-19 20:50 UTC
Re: How to override default DB settings...Connect to remote
Prem Thilagar wrote:> please guide me through this it will be really helpful. > thanks in advance > premThere is a book entitled "Rails Recipes" by Chad Fowler that goes into detail with the exact scenario you describe: http://www.pragmaticprogrammer.com/titles/fr_rr/ In short, there is a migration task (forgot it''s name and I am at work) that will dump your current schema to a migration file. Next, you create the schema_info table and bump it''s rev number... and voila, you now have your schema involved with migrations! As for the ActiveRecord overrides, look at the rails documentation on which options to specify to your models to get them to work with a legacy db.. it''s pretty straight forward and I was able to do it in the past with a relatively normalized database. If your database is a mess however, then it''s probably not worth the effort and you should probably try fixing your db model prior to rails integration.. OH.. at the risk of being obvious or insulting, please dump your db prior to doing anything as the slightest mistake can be very costly. I don''t feel so bad because Chad mentions it too.. :) Fowler''s book is worth it''s weight in gold and it was a very cool read with a lot of "That is so f#$@#king cool! " episodes that I had to stop reading it before bedtime. ilan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---