Forum: Ruby on Rails Database and model folder

Posted by 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
Posted by 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 (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.