Forum: Ruby on Rails Database tables

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dark A. (Guest)
on 2006-06-11 19:11
(Received via mailing list)
Preface - Having read through a good portion of material on Ruby and
Rails I
think it's time to jump in head first and figure my around from there.
As
suggested (somewhere) I've picked one small piece of application
functionality and decided to start on that first.

So, perhaps I can get a little push into thinking the Rails way as I've
done
this application in PHP.

Essentially I have a form for users to enter information and make
submissions to a database.  The way I currently have the table set up
for
this form is the user sees the options in the labels and form elements
but
what goes into the table they are submitting to are just id's. Lots and
lots
of joins going on here with "static" tables.  Example would be for U.S.
States, where the static table shows: id=1 state=Alaska, or another
might be
id=1 time-30 days, id=2 time 60 days, etc.
Anyway, this is not a call for database assistance but felt I should
explain
what I'm dealing with first.

Bottomline: My next steps at this point are to
1-create the schema file for all these tables
2-create and rake the migration files.

I think the steps above are close to what is needed.

Things get hazy after this though,
3-Would I need to create a controller and model for each table or just
the
main one (where the submissions will go) ?
My thoughts are "probably not" but then how to set up the form correctly
to
get the correct values into the table.

My apologies if this post is inappropriate or asking for too much.  I
might
be rushing ahead foolishly.

TIA
Stuart
Tom M. (Guest)
on 2006-06-11 22:17
(Received via mailing list)
On Jun 11, 2006, at 8:08 AM, Dark A. wrote:

> 3-Would I need to create a controller and model for each table or
> just the main one (where the submissions will go) ?
> My thoughts are "probably not" but then how to set up the form
> correctly to get the correct values into the table.

You'll need at least 1 controller per application, and one model per
table.

Use helpers to create HTML input elements from joined tables.

--
-- Tom M.
This topic is locked and can not be replied to.