Forum: Ruby on Rails Rails noob db questions

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.
Josh McDonald (Guest)
on 2006-03-28 04:02
(Received via mailing list)
Hi, I'm trying to get my head around rails, but the documentation seems
sparse at best (and manuals.rubyonrails.com is unreachable from my
location
for whatever reason). I'm trying to figure out a few things:

1) The documentation for the magicfields mentions using datetimes
instead of
timestamps, which pgsql doesn't appear to support. What's the answer in
this
case?

2) All the tutorials seem to be geared towards trivial data
relationships.
What if I have table SHOP and table PERSON, but each record in SHOP has
a
OWNER, MANAGER, and a collection of EMPLOYEES. How should you structure
this
in your tablespace to take the best advantage of activerecord?

3) Am I wrong in the assumption that all this needs to be sorted out at
the
database level before I go and generate models and controllers? Where do
you
put code that you don't want to get blatted if and when the schema
changes
and you need to regenerate?

TIA,
-Josh

--
          "wookin' pa nub in all da wong paces, wookin' pa nub"

              [ Josh 'G-Funk' McDonald ]  --   [ 0437 221 380 ]
Craig W. (Guest)
on 2006-03-28 04:30
(Received via mailing list)
On Tue, 2006-03-28 at 10:01 +1000, Josh McDonald wrote:
> Hi, I'm trying to get my head around rails, but the documentation
> seems sparse at best (and manuals.rubyonrails.com is unreachable from
> my location for whatever reason). I'm trying to figure out a few
> things:
>
> 1) The documentation for the magicfields mentions using datetimes
> instead of timestamps, which pgsql doesn't appear to support. What's
> the answer in this case?
----
fields named 'created_on' 'updated_on' 'created_at' 'updated_at' should
work
----
>
> 2) All the tutorials seem to be geared towards trivial data
> relationships. What if I have table SHOP and table PERSON, but each
> record in SHOP has a OWNER, MANAGER, and a collection of EMPLOYEES.
> How should you structure this in your tablespace to take the best
> advantage of activerecord?
----
I think the Active Web D. With Rails discusses this - so does
some of the wiki pages...I think it's called STI (single table
inheritance) - that would be one way of handling the employees, owners,
managers within one table.
----
>
> 3) Am I wrong in the assumption that all this needs to be sorted out
> at the database level before I go and generate models and controllers?
> Where do you put code that you don't want to get blatted if and when
> the schema changes and you need to regenerate?
----
Not at all...I think you are on the mark...get it sorted out now before
you have to go back and fix a bunch of forms/lists/etc.

Craig
This topic is locked and can not be replied to.