aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators
Commit message (Collapse)AuthorAgeFilesLines
* Fix Generation of proper migration whenKuldeep Aggarwal2014-03-251-3/+7
| | | | | | | | | | | | ActiveRecord::Base.pluralize_table_names = false. Previously, generation a migration like this: rails g migration add_column_name_to_user name would not generating the correct table name. Fixes #13426.
* Make `.next_migration_number` reusable for third party AR generators.Yves Senn2013-09-302-8/+20
|
* copy edits[ci skip]Vijay Dev2013-05-191-1/+1
|
* Added documentation for model migration generationaditya-kapoor2013-05-141-0/+4
|
* Added documentation for ↵aditya-kapoor2013-05-101-0/+4
| | | | ActiveRecord::Generators::MigrationGenerator.next_migration_number
* Add support for generate scaffold password:digestSam Ruby2013-03-132-1/+8
| | | | | | | | | | * 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-013-3/+10
| | | | | | | | | | | | | | | | 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.
* Migration generators use `change` even for destructive methods [#8267]Marc-Andre Lafortune2012-12-211-16/+4
|
* Remove observers and sweepersRafael Mendonça França2012-11-282-19/+0
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* nodoc AR::Generators [ci skip]Francesco Rodriguez2012-10-204-10/+10
|
* Remove mass assignment security from ActiveRecordGuillermo Iguaran2012-09-161-5/+0
|
* add mini-validator on creating migrationJan Bernacki2012-09-061-0/+9
| | | | move validation to AR
* Extract ActiveRecord::SessionStore from RailsPrem Sichanugrist2012-08-242-36/+0
| | | | | This functionality will be available from gem `active_record-session_store` instead.
* removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-061-2/+2
| | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-021-1/+0
|
* Add fkey attributes to `join_table` migration generatorAleksey Magusev2012-07-191-2/+10
|
* Add join table migration generatorAleksey Magusev2012-07-182-6/+27
| | | | | | | | | | | | | For instance, running rails g migration CreateMediaJoinTable artists musics:uniq will create a migration with create_join_table :artists, :musics do |t| # t.index [:artist_id, :music_id] t.index [:music_id, :artist_id], unique: true end
* Add references statements to migration generatorAleksey Magusev2012-07-081-4/+16
| | | | | | | | | | | | | AddXXXToYYY/RemoveXXXFromYYY migrations are produced with references statements, for instance rails g migration AddReferencesToProducts user:references supplier:references{polymorphic} will generate the migration with: add_reference :products, :user, index: true add_reference :products, :supplier, polymorphic: true, index: true
* 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
* Refactor migration generatorOscar Del Ben2012-05-181-6/+3
|
* Automatically create indexes for references/belongs_to statements in migrations.Joshua Wood2012-04-141-1/+2
|
* Fix indenting in migration generatorColin Bartlett2012-03-271-2/+2
| | | | | | | | | | | | | | | | $ rails generate migration remove_foo_from_bars foo:string This currently generates: def up remove_column :bars, :foo end Fix it: def up remove_column :bars, :foo end
* Avoid another blank line in generated migration and remove assertion as per ↵Marcelo Silveira2012-03-211-1/+1
| | | | @spastorino request
* Merge pull request #5532 from mhfs/migration_blank_lineJosé Valim2012-03-211-1/+1
|\ | | | | Remove blank line from generated migration
| * Remove blank line from generated migrationMarcelo Silveira2012-03-201-1/+1
| |
* | Generate Migration Thats Adds Removed IndexTravis Jeffery2012-03-211-0/+3
|/ | | | | When generating a migration that removes a field with an index, the down will add both the field and its index.
* Whitelist all attribute assignment by default.Michael Koziarski2012-03-052-0/+9
| | | | 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.
* Remove unused implementation of next_migration_numberMarcelo Silveira2012-02-232-17/+0
|
* Tidy up migration types.José Valim2011-12-244-11/+10
|
* added ability to specify from cli when generating a model/migration whether ↵Dmitrii Samoilov2011-12-244-7/+16
| | | | particular property should be an index like this 'rails g model person name:string:index profile:string'
* Use change in place of up and down in sessions table migrationVijay Dev2011-05-281-5/+1
|
* for => each in model migration templateGuillermo Iguaran2011-05-201-1/+1
|
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-131-1/+1
| | | | | | After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now. It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
* Change Object#either? to Object#among? -- thanks to @jamesarosen for the ↵David Heinemeier Hansson2011-04-121-1/+1
| | | | suggestion!
* Using Object#in? and Object#either? in various placesPrem Sichanugrist2011-04-111-1/+2
| | | | There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
* Delete blank lines in migration generatorSantiago Pastorino2011-02-021-3/+2
|
* Configurable generation of add_index for references columnsMichał Łomnicki2011-02-012-0/+3
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Use Rails 3.1 `change` method in 'add_' migration generatorPrem Sichanugrist2011-01-041-0/+8
|
* 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-173-6/+6
|
* Add namespacing for observer generatorPiotr Sarnacki2010-09-251-0/+2
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Generators fix: properly check if module should be created when creating a ↵Piotr Sarnacki2010-09-251-1/+1
| | | | | | namespaced model Signed-off-by: José Valim <jose.valim@gmail.com>
* Refactor namespaced generators to use module_namespacing block helperPiotr Sarnacki2010-09-243-2/+6
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Generators are not aware of namespace of isolated engines and applicationsPiotr Sarnacki2010-09-241-2/+2
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Implemented ActiveRecord::Migrations#copy based on James Adam's ideaPiotr Sarnacki2010-09-031-0/+6
| | | | | | | | | | | | | | | ActiveRecord::Migration#copy allows to copy migrations from one place to another, changing migrations versions and adding scope to filename. For example: ActiveRecord::Migration.copy("db/migrate", :blog_engine => "vendor/gems/blog/db/migrate") will copy all migrations from vendor/gems/blog/db/migrate to db/migrate with such format: Versions of copied migrations will be reversioned to be appended after migrations that already exists in db/migrate
* split out active_record migration logic so others can easily reuse [#5389 ↵Jack Dempsey2010-09-012-10/+17
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Avoid a blank line before the add/remove columnsSantiago Pastorino2010-06-251-2/+2
|
* Line break in migration template and nicer code indentationŁukasz Strzałkowski2010-06-251-6/+8
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>