aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/migration.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Lint/ErbNewArguments` cop to avoid the deprecated arguments warningRyuta Kamizono2019-02-011-2/+1
| | | | | | Related 5754a29a974d31cab2b4392716b9825a3d910a69. And follows Ruby standard library style https://github.com/ruby/ruby/commit/3406c5d.
* Deprecate safe_level of `ERB.new` in Ruby 2.6Koichi ITO2018-03-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary In a Rails application using Ruby 2.6.0-dev, when running `bin/rails g migration` with `RUBYOPT=-w`, an ERB deprecation warnings will be displayed. ```console % ruby -v ruby 2.6.0dev (2018-03-03 trunk 62644) [x86_64-darwin17] % bin/rails -v Rails 6.0.0.alpha % RUBYOPT=-w bin/rails g migration create_foos (snip) /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments. /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead. /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead. create db/migrate/20180304002144_create_foos.rb ``` This PR suppresses the above deprecation warnings in Ruby 2.6.0-dev. This warning is due to the interface of `ERB.new` will change from Ruby 2.6. > Add :trim_mode and :eoutvar keyword arguments to ERB.new. > Now non-keyword arguments other than first one are softly deprecated > and will be removed when Ruby 2.5 becomes EOL. [Feature #14256] https://github.com/ruby/ruby/blob/2311087b685e8dc0f21f4a89875f25c22f5c39a9/NEWS#stdlib-updates-outstanding-ones-only The following addresses are related Ruby's commit. https://github.com/ruby/ruby/commit/cc777d0 Also this PR will change `ERB.new` used in `tasks/release.rb`. ### Other Information This PR uses `ERB.version` to switch `ERB.new` interface. Because Rails 6 supports multiple Ruby versions (Ruby 2.4.1 or higher), it need to use the appropriate interface. Using `ERB.version` instead of `RUBY_VERSON` is based on the following patch. https://github.com/ruby/ruby/pull/1826 This patch is built into Ruby. https://github.com/ruby/ruby/commit/40db89c0934c23d7464d47946bb682b9035411f9
* [Railties] require_relative => requireAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* [Railties] require => require_relativeAkira Matsuda2017-07-011-1/+1
|
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* applies new string literal convention in railties/libXavier Noria2016-08-061-6/+6
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Move default uuid generation to active_recordJon McCartie2015-10-231-5/+0
|
* Set active_record config for always creating uuids in generatorsJon McCartie2015-10-201-0/+5
|
* migrations Class methods have nodoc, fix it for API [ci skip]Gaurav Sharma2015-10-141-5/+5
|
* Fix typo 'has' => 'have'Sean Collins2015-01-251-1/+1
|
* Fix typo 'another frameworks' => 'other frameworks'Sean Collins2015-01-251-1/+1
|
* Add CreateMigration actionGert Goet2014-01-281-16/+22
| | | | | | | | | | This Thor-action isolates the logic whether to (over-)write migration and what is shown to the user. It's modelled after Thor's CreateFile-action. This solves the issue that removing a non-existing migration, tried to remove the template-path (#13588). Related issues: #12674
* Using ActiveSupport::Concern instead of plain regular Ruby hooks in ↵aditya-kapoor2013-07-011-4/+3
| | | | railties/lib/rails/generators/migration.rb file
* Added extra comment when a migration already exists of the same name.wangjohn2013-02-151-1/+1
| | | | | | User should know that he can overwrite the previous migration. This comes in handy especially when generating models which were previously created then removed.
* Removing ==Examples and last blank lines of docs from railtiesFrancesco Rodriguez2012-05-141-4/+0
|
* Skip creating migration if --skip option is passed to model generator [#6144 ↵Piotr Sarnacki2010-12-161-1/+1
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove existing migration when using 'rails generate model' with --force ↵David Trasbo2010-09-181-1/+5
| | | | | | [#5526 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Changes migration number to version due to ambiguity. [#3065 state:committed]Rizwan Reza2010-03-281-3/+3
|
* No more vendored thor.José Valim2010-02-031-5/+3
|
* Ensure that attr_reader methods in generators are protected.José Valim2010-02-021-8/+5
|
* Change Rails::Generators::Migration protected instance methods to class ↵Szymon Nowak2010-02-021-23/+27
| | | | | | methods. [#3820 status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Move railties/lib/* into railties/lib/*Yehuda Katz + Carl Lerche2009-09-241-0/+65