aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators/active_record/model/templates
Commit message (Collapse)AuthorAgeFilesLines
* Use .tt extension to all the template filesRafael Mendonça França2017-11-132-0/+0
| | | | | | | | Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878.
* Stop creating ApplicationRecord on model generationLisa Ugray2017-07-241-5/+0
| | | | | | | | | | | | | | When generating models, we created ApplicationRecord in the default location if no file existed there. That was annoying for people who moved it to somewhere else in the autoload path. At this point, the vast majority of apps should have either run the upgrade script or generated a model since upgrading. For those that haven't the error message after generating a new model should be helpful: NameError: uninitialized constant ApplicationRecord To ease friction in that case, this also adds a generator for ApplicationRecord.
* correctly check `ApplicationRecord` is exist in moutable engineyuuji.yaginuma2016-02-251-0/+2
| | | | Follow up to 1813b29fc7632959800252f36e4b2e6ed4ac7266
* Generate ApplicationRecord if it does not already existJon Moss2016-02-221-0/+3
|
* Add Secure Token Generatorrobertomiranda2015-01-111-0/+3
|
* Add a `required` option to the model generatorSean Griffin2014-08-081-1/+1
| | | | | | | | | | | Syntax was chosen to follow the passing of multiple options to decimal/numeric types. Curly braces, and allowing any of `,`, `.`, or `-` to be used as a separator to avoid the need for shell quoting. (I'm intending to expand this to all columns, but that's another PR. The `required` option will cause 2 things to change. `required: true` will be added to the association. `null: false` will be added to the column in the migration.
* Add support for generate scaffold password:digestSam Ruby2013-03-131-1/+4
| | | | | | | | | | * adds password_digest attribute to the migration * adds has_secure_password to the model * adds password and password_confirmation password_fields to _form.html * omits password entirely from index.html and show.html * adds password and password_confirmation to the controller * adds unencrypted password and password_confirmation to the controller test * adds encrypted password_digest to the fixture
* Support creating a table migration generatorSammy Larbi2013-03-011-15/+0
| | | | | | | | | | | | | | | | Sometimes you want to create a table without an associated model and test, which is also not a join table. With this commit, you can now do that. Example: rails g migration create_posts title:string or rails g migration CreatePosts title:string This commit also moves the template the model generator uses for the migration to the migration templates folder, as it seems a more sensible place for it now that it is shared code.
* Remove mass assignment security from ActiveRecordGuillermo Iguaran2012-09-161-5/+0
|
* Fixed generating namespaced table_name_prefix in enginesWojciech Wnętrzak2012-07-061-1/+1
|
* Add polymorphic option to model generatorAleksey Magusev2012-06-271-1/+1
| | | | | | | | | | For instance, $ rails g model Product supplier:references{polymorphic} generate model with `belongs_to :supplier, polymorphic: true` association and appropriate migration. Also fix model_generator_test.rb#L196 and #L201
* Whitelist all attribute assignment by default.Michael Koziarski2012-03-051-0/+5
| | | | Change the default for newly generated applications to whitelist all attribute assignment. Also update the generated model classes so users are reminded of the importance of attr_accessible.
* Tidy up migration types.José Valim2011-12-241-7/+2
|
* added ability to specify from cli when generating a model/migration whether ↵Dmitrii Samoilov2011-12-241-2/+5
| | | | particular property should be an index like this 'rails g model person name:string:index profile:string'
* for => each in model migration templateGuillermo Iguaran2011-05-201-1/+1
|
* Delete blank lines in migration generatorSantiago Pastorino2011-02-021-3/+2
|
* Configurable generation of add_index for references columnsMichał Łomnicki2011-02-011-0/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Use Rails 3.1 `change` method in model generatorPrem Sichanugrist2011-01-041-5/+1
|
* Generate add_index by default when giving type belongs_to or referencesSantiago Pastorino2010-12-161-0/+4
|
* updating generatorsAaron Patterson2010-11-171-2/+2
|
* Refactor namespaced generators to use module_namespacing block helperPiotr Sarnacki2010-09-242-0/+4
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Generate module file for namespaced models [#4230 state:resolved]Andrew White2010-04-121-0/+5
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Load generators from both lib/rails/generators and lib/generators. Using the ↵José Valim2010-03-232-0/+21
former since it's less obstrusive.