aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/generated_attribute.rb
Commit message (Collapse)AuthorAgeFilesLines
* Pare back default `index` option for the migration generatorPrathamesh Sonpatki2016-01-241-2/+3
| | | | | | | | | | - Using `references` or `belongs_to` in migrations will always add index for the referenced column by default, without adding `index:true` option to generated migration file. - Users can opt out of this by passing `index: false`. - Legacy migrations won't be affected by this change. They will continue to run as they were before. - Fixes #18146
* Add Secure Token Generatorrobertomiranda2015-01-111-1/+5
|
* Use the new `foreign_key` option on `references` in generatorsSean Griffin2014-12-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes `rails g model Post user:references` from def change create_table :posts do |t| t.references :user, index: true end add_foreign_key :posts, :users end to def change create_table :posts do |t| t.references :user, index: true, foreign_key: true end end Changes `rails g migration add_user_to_posts user:references` from def change add_reference :posts, :users, index: true add_foreign_key :posts, :users end to def change add_reference :posts, :users, index: true, foreign_key: true end
* Add a `required` option to the model generatorSean Griffin2014-08-081-4/+20
| | | | | | | | | | | 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.
* Fix Generation of proper migration whenKuldeep Aggarwal2014-03-251-0/+4
| | | | | | | | | | | | 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.
* Add support for generate scaffold password:digestSam Ruby2013-03-131-0/+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
* Add GeneratedAttribute#column_name to get the name of the column in theRafael Mendonça França2012-12-101-3/+7
| | | | database
* Use Ruby 1.9 Hash syntax in railtiesRobin Dupret2012-10-141-4/+4
|
* update Rails::Generators docs [ci skip]Francesco Rodriguez2012-10-071-1/+1
|
* Add fkey attributes to `join_table` migration generatorAleksey Magusev2012-07-191-1/+9
|
* Add join table migration generatorAleksey Magusev2012-07-181-1/+2
| | | | | | | | | | | | | 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 polymorphic option to model generatorAleksey Magusev2012-06-271-2/+12
| | | | | | | | | | 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 GeneratedAttributesCarlos Antonio da Silva2012-04-221-7/+10
| | | | | | | | * Move reference? method to class to remove duplicated code * Move to_sym typecast from #initialize to .parse method (make it easier to refactor reference?), remove AS object/blank require * Use []= instead of merge!({}) * Remove in? in favor of include?, remove AS object/inclusion require
* the index option is always created if the type is one of references or ↵Vijay Dev2012-04-181-2/+4
| | | | belongs_to. Refactoring it to a simpler form and fixing the build
* let's not use `and` in place of `&&`Vijay Dev2012-04-181-1/+1
|
* Automatically create indexes for references/belongs_to statements in migrations.Joshua Wood2012-04-141-0/+4
|
* Fix failing test from [7619bcf2]Prem Sichanugrist2012-01-301-1/+1
|
* rewrites a couple of alternations in regexps as character classesXavier Noria2012-01-301-1/+1
| | | | | Character classes are the specific regexp construct to express alternation of individual characters.
* Support decimal{1,2} and decimal{1-2} and decimal{1.2} so it works fine with ↵José Valim2012-01-221-2/+2
| | | | | | | | bash, zsh, etc, closes #4602 Conflicts: railties/test/generators/migration_generator_test.rb
* fix a broken testVijay Dev2012-01-151-1/+1
| | | | | | The commit 2f632f53919d2b44dbb2cfaadabed2310319f005 extracted the options into constants and while doing so, there was a minor error of using a wrong constant name.
* Extract index and uniq index options to constantsCarlos Antonio da Silva2012-01-141-4/+7
|
* Use 1.9 hash syntax instead.José Valim2011-12-241-2/+2
|
* Fix regexp intervals.José Valim2011-12-241-2/+2
|
* Tidy up migration types.José Valim2011-12-241-33/+43
|
* added ability to specify from cli when generating a model/migration whether ↵Dmitrii Samoilov2011-12-241-4/+48
| | | | particular property should be an index like this 'rails g model person name:string:index profile:string'
* Generate valid default fixtures for models with a type columnMarc-Andre Lafortune2011-07-111-1/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Attributes on scaffold and model generators default to string.José Valim2011-06-171-1/+1
| | | | This allows the following: "rails g scaffold Post title body:text author"
* generate HTML5 number_field tag for integer fieldsAkira Matsuda2011-05-161-6/+7
|
* 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?.
* Output a friendly message when no type given for GeneratedAttribute [#5461 ↵rohit2010-09-021-0/+1
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Rails::Generators::GeneratedAttribute: tests, cleanups and a bugfix [#4631 ↵Jeff Kreeftmeijer2010-06-101-1/+2
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* using :time_select when the attribute type is :time in the scaffold ↵Jeff Kreeftmeijer2010-05-161-6/+7
| | | | | | generator. [#2377 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Move railties/lib/* into railties/lib/*Yehuda Katz + Carl Lerche2009-09-241-0/+48