Benevolent patriarch David Alan Black has written an article on Rails which is at the Ruby Garden (http://rubygarden.org). marcel -- Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>
One thing I noted about his article is that he "complained" (wasn''t so much a complaint as an observation) that he needed to modify the SQL database table and column names to enable Rails'' relational features to work. In actuality, he could have simply overridden the table_name class method on each model and used the extra parameters to the association methods to get around this. If you''re working on an application which is the _only_ thing that will be using the database in question, simply changing the table/column names is probably a bit easier in the long run; but the fact that these "requirements" can be easily overridden is nice when you have to work with a database that may be in use by other applications as well. On Tue, 26 Oct 2004 20:12:55 -0400, Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org> wrote:> Benevolent patriarch David Alan Black has written an article on Rails which > is at the Ruby Garden (http://rubygarden.org).-- Regards, John Wilger ----------- Alice came to a fork in the road. "Which road do I take?" she asked. "Where do you want to go?" responded the Cheshire cat. "I don''t know," Alice answered. "Then," said the cat, "it doesn''t matter." - Lewis Carrol, Alice in Wonderland
On Wed, 27 Oct 2004 08:38:13 -0400, John Wilger <johnwilger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you''re working on an application which is the _only_ thing that > will be using the database in question, simply changing the > table/column names is probably a bit easier in the long run; but the > fact that these "requirements" can be easily overridden is nice when > you have to work with a database that may be in use by other > applications as well.I believe AR''s support for custom column names is incomplete, and at least it can be difficult to figure out how to do it correctly. Some time ago I got Rails into a stack overflow (which sometimes crashed Ruby!) that was traceable to naming a foreign key column the same as the table it was linking to. At that point I decided to just put in whatever names AR expected and go with the flow. Someday I''ll get ''round to reporting or fixing that particular bug, but I think many folks would agree that Active Record is currently optimized for a database schema that meets its particular expectations. To that end...I''d like your input: It seems like a logical step to teach Active Record to create its own database tables, or at least generate the required SQL code, directly from the AR class definitions. I''ve posted a proposal at http://rubyonrails.org/show/ActiveSchema that addresses this possibility. I would welcome feedback, either on that page or on this list. -- Ryan Platte