Ideas for rails


#1

Here are a few suggestions, wondering what others thought:
When you generate a model for a DB table, it would be nice if the
model.rb contained the DB schema (kind of like # commented out schema)
right in the model file. This would make reference WAY easier and put
all of the DB stuff in one easy file. Thanks.

also nice, of course, woudl be for rails to try and ‘guess’ the
relationships among tables, and auto-generate the ‘has_many’ or
‘belongs_to’, if it is possible based on the syntax. Thanks.


#2

rogerdpack wrote:

Would this help?
http://magicmodels.rubyforge.org/

Cheers
Mohit.


#3

Yeah something similar to that–it would be nice to also ‘see’ the
schema, for easy reference.


#4

Here are a few suggestions, wondering what others thought:
When you generate a model for a DB table, it would be nice if the
model.rb contained the DB schema (kind of like # commented out schema)
right in the model file. This would make reference WAY easier and put
all of the DB stuff in one easy file. Thanks.

http://plugins.radrails.org/directory/show/12

From the readme…

Add a comment summarizing the current schema to the top
of each ActiveRecord model source file:

Schema as of Sun Feb 26 21:58:32 CST 2006 (schema version 7)

id :integer(11) not null

quantity :integer(11)

product_id :integer(11)

unit_price :float

order_id :integer(11)

class LineItem < ActiveRecord::Base
belongs_to :product

 . . .

Does not cope with models in sub-directories of app/models.

Author:
Dave T.
Pragmatic Programmers, LLC

Released under the same license as Ruby. No Support. No Warranty.

Back up your model files before using…


#5

thanks!