This project is archived and is in readonly mode.
Extend model generator to create association declarations
-
Ed Spencer
This is a good idea, and something I have done with my own extensions in the past. Getting the syntax right is tricky though, as some things could be chained, e.g.:
script/generate model Suppler name:string:vp:vu products:has_many
Or
script/generate model Suppler name:string:validates_presence:validates_uniqueness products:has_many
Could each generate:
class Supplier < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name has_many :products end
The first syntax is quite opaque, and the second almost as verbose as the actual declarations in the class. I prefer the first... but there might be a better way.
This of course becomes more powerful when the unit tests are generated also, correctly testing the additional behaviour (slightly OT but the type of syntax in http://github.com/edspencer/rspe... would lend itself well to this situation)
-
Pratik
- State changed from new to wontfix
Not sure if this is a right fit or not. Let's have a plugin first.
