Forum: Ruby on Rails Database and model folder

23157aad31883016f0facbb7bff5e3aa?d=identicon&s=25 Shalini Sah (Guest)
on 2012-05-31 14:43
(Received via mailing list)
Hi,

I have a database with multiple tables. How do I directly pick the
information from the database and populate my model folder with
classes instead of doing it manually? Can some one direct me to the
specific set of commands for this.

Thanks & Regards,
Shalini
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2012-05-31 14:58
(Received via mailing list)
On 30 May 2012 10:51, Shalini Sah <shalinisah6692@gmail.com> wrote:
> Hi,
>
> I have a database with multiple tables. How do I directly pick the
> information from the database and populate my model folder with
> classes instead of doing it manually? Can some one direct me to the
> specific set of commands for this.

There may be a way of doing this but I do not know it.  Note though
that it is easy to do by hand.  For each table (table widgets for
example) make a file widget.rb and in there put

class Widget < ActiveRecord::Base
end

Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.