Home > rails-generator-scaffold_hmt

rails-generator-scaffold_hmt

Rails-generator-scaffold_hmt is a project mainly written in RUBY and JAVASCRIPT, it's free.

Provides a rails 3.1.x generator that allows to scaffold has_many :through relations.

First try to provide a generator for Rails 3.x that scaffolds a has_many :through relation. See the stackoverflow question for some context.

To use the generator for "has_many :through", you have to do the following steps:

  1. Install the generator by copying the directory "scaffold_hmt" to your rails application in the directory 'lib/generators'.
  2. Start the generator by calling from your home directory of the application: rails g scaffold_htm Model1 Model2.
  3. The generator will generate or change the following files:
    • Migration <timestamp>_create_<model1>_<model2>.rb
    • Model file <model1>s_<model2>.rb
    • Insert into <model1>.rb and <model2>.rb the has_many :through relations.

The mandatory arguments for the generator are the model names. They will be sorted alphabetically if necessary. If a third argument (the join model name) is given, it will be used, if not, it will be computed:

join table name: `<model1>s_<model2>s`
join model name: `<Model1>s<Model2>`
Previous:truesight