mliebelt/rails-generator-scaffold_hmt — Issue #2: Add argument `join_model` with a reasonable default
Author: mliebelt
Created: 2011-10-13 05:24:11+00:00
State: open

When you use `has_many :through`, you often want to use a semantic meaningful join model name (and according join table name). See the examples in http://guides.rubyonrails.org/association_basics.html#the-has_many-through-association (physicians has n:m appointments with patients). If the join model name is **not** given, it will constructed with the default explained in http://guides.rubyonrails.org/association_basics.html#updating-the-schema (Creating Join Tables ...).

So it should be possible to call the generation like that:

* `rails g scaffold_hmt Physician Patient Appointment` where the two models are Physician and Patient, and the join model will be created as Appointment.
* `rails g scaffold_hmt Physician Patient` with create a join model named `PatientsPhysician` with join table named `patients_physicians`.