Hi there,
Like numerous times I am generating models, I go in to make fields required and validates_presence_of them.
Would it be easy if we could just say:
Hi there,
Like numerous times I am generating models, I go in to make fields required and validates_presence_of them.
Would it be easy if we could just say:
I would rather have it look like the following
Rails g model contact name:string:required age:int:required
Thanks for your participation! Hmm, maybe. However I am afraid this might get a bit cumbersome when writing more then 4 fields. The word required in this sample is the longest word of this command. Maybe req? Are there any other generators out there that tackle this problem?
Also an * (asterisk) is universal hint that something is required
An asterisk is actually going to be very painful to use, because your shell is going to treat it as a shell expansion by default rather than passing it along to Rails.
Ha, well that makes the choice easy then, then :required is probably the way to go.