aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
Commit message (Collapse)AuthorAgeFilesLines
* Factorize bin/update in bin/setup, and make bin/setup idempotentDavid Stosik2019-04-172-35/+3
| | | | | | | | | | | | | | | `bin/setup` and `bin/update` are currently almost the same file. The only thing that keeps them apart is that one is running `bin/rails db:setup` and the other `bin/rails db:migrate`. I'm suggesting here that they should be a unique script, which needs to be idempotent. - New to a project, need to get started? `bin/setup` - Need to install new dependencies that were added recently? `bin/setup`. Before deprecating `bin/update`, I'm suggesting we just have it call `bin/setup`.
* Add collection cache versioningLachlan Sylvester2019-04-161-0/+4
| | | | | | | | | | | | | | | Cache versioning enables the same cache key to be reused when the object being cached changes by moving the volatile part of the cache key out of the cache key and into a version that is embedded in the cache entry. This is already occurring when the object being cached is an `ActiveRecord::Base`, but when caching an `ActiveRecord::Relation` we are currently still putting the volatile information (max updated at and count) as part of the cache key. This PR moves the volatile part of the relations `cache_key` into the `cache_version` to support recycling cache keys for `ActiveRecord::Relation`s.
* [Rails::MailersController] Do not leak I18n global setting changesThierry Joyal2019-04-161-2/+5
|
* Merge pull request #35906 from yoones/notes-tags-registrationRafael França2019-04-152-2/+15
|\ | | | | Notes tags registration
| * Adds `register_tags`Younes SERRAJ2019-04-122-2/+15
| |
* | generate config.cache_classes = false if SpringXavier Noria2019-04-141-5/+10
| |
* | deprecates autoloading constants during initialization [closes #35745]Xavier Noria2019-04-141-0/+37
| | | | | | | | See rationale in the warning message included in the patch.
* | Do not treat `environment_desc` as commandsyuuji.yaginuma2019-04-131-1/+3
| | | | | | | | For avoid to show `environment_desc` in help.
* | Merge pull request #35916 from soartec-lab/delete_not_use_methodRyuta Kamizono2019-04-111-15/+0
|\ \ | |/ |/| Delete not user method for plugin_generator
| * Delete not user method for plugin_generatorsoartec-lab2019-04-091-15/+0
| |
* | Only override async adapter when seedingBatedUrGonnaDie2019-04-091-1/+7
|/
* depend on Zeitwerk 2Xavier Noria2019-04-071-1/+1
|
* Use `execute_batch2` rather than `execute_batch` to fix performance ↵Ryuta Kamizono2019-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regression for fixture loading d8d6bd5 makes fixture loading to bulk statements by using `execute_batch` for sqlite3 adapter. But `execute_batch` is slower and it caused the performance regression for fixture loading. In sqlite3 1.4.0, it have new batch method `execute_batch2`. I've confirmed `execute_batch2` is extremely faster than `execute_batch`. So I think it is worth to upgrade sqlite3 to 1.4.0 to use that method. Before: ``` % ARCONN=sqlite3 bundle exec ruby -w -Itest test/cases/associations/eager_test.rb -n test_eager_loading_too_may_ids Using sqlite3 Run options: -n test_eager_loading_too_may_ids --seed 35790 # Running: . Finished in 202.437406s, 0.0049 runs/s, 0.0049 assertions/s. 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips ARCONN=sqlite3 bundle exec ruby -w -Itest -n test_eager_loading_too_may_ids 142.57s user 60.83s system 98% cpu 3:27.08 total ``` After: ``` % ARCONN=sqlite3 bundle exec ruby -w -Itest test/cases/associations/eager_test.rb -n test_eager_loading_too_may_ids Using sqlite3 Run options: -n test_eager_loading_too_may_ids --seed 16649 # Running: . Finished in 8.471032s, 0.1180 runs/s, 0.1180 assertions/s. 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips ARCONN=sqlite3 bundle exec ruby -w -Itest -n test_eager_loading_too_may_ids 10.71s user 1.36s system 95% cpu 12.672 total ```
* Don't normalize `original_app_name`Ryuta Kamizono2019-04-031-2/+2
| | | | | `original_app_name` is used to show error message if giving app name is invalid, it should be shown raw app name.
* Merge pull request #35805 from excid3/attachments-field-generatorsRafael França2019-04-027-20/+51
|\ | | | | Add attachment and attachments field generators
| * Add attachment and attachments field generatorsChris Oliver2019-03-307-20/+51
| |
* | Rename `connection` option to `database` in `dbconsole` commandyuuji.yaginuma2019-04-021-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduced `connection` option for specifying spec with 1acd9a6464668d4d54ab30d016829f60b70dbbeb. But now we are using the `database` to specify the same value in other commands. * https://github.com/rails/rails/blob/0a0f115031b64b5335fa88543c40df4194dfb428/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb#L11 * https://github.com/rails/rails/blob/0a0f115031b64b5335fa88543c40df4194dfb428/activerecord/lib/rails/generators/active_record/model/model_generator.rb#L17 The options provided to the users should be uniform. Since the term "database" is used in rake task etc, So I want to be able to use it in `dbconsole` command. Also I deprecated the `connection` option because I think that it would be confusing if there are multiple options to specify a same value.
* | Merge pull request #35820 from sharang-d/url-to-URL-except-actionpackRyuta Kamizono2019-04-021-4/+4
|\ \ | | | | | | url -> URL where apt except inside actionpack/
| * | url -> URL where apt except inside actionpack/Sharang Dashputre2019-04-011-4/+4
| | |
* | | Include final newline in generated .ruby-versionOrhan Toy2019-04-011-1/+1
|/ /
* | optimizes eager loading in :zeitwerk modeXavier Noria2019-03-301-22/+9
| | | | | | | | | | | | | | | | | | | | | | During initialization, the eager load paths of engines are unshifted into AS::Dependencies.autoload_paths. After that, the collection is frozen. (See the initializers in railties/lib/rails/engine.rb.) Hence, there is no eager load path that is not an autoload path too, and so the array difference in the deleted code is always an empty array. Just do nothing.
* | fixes eager loading edge case in :zeitwerk modeXavier Noria2019-03-301-2/+5
|/
* Add rich_text field to model generatorsChris Oliver2019-03-282-10/+19
|
* bumps Zeitwerk and BootsnapXavier Noria2019-03-261-1/+1
|
* Merge pull request #35732 from rails/webdriversGuillermo Iguaran2019-03-241-2/+2
|\ | | | | Replace chromedriver-helper with webdrivers
| * Use webdrivers instead of chromedriver-helper in new appsGuillermo Iguaran2019-03-241-2/+2
| |
* | Merge pull request #35723 from sikachu/disable-sandbox-flagGuillermo Iguaran2019-03-242-1/+9
|\ \ | |/ |/| Add config.disable_sandbox option to Rails console
| * Add config.disable_sandbox option to Rails consolePrem Sichanugrist2019-03-232-1/+9
| | | | | | | | | | | | | | | | | | | | | | A long-running `rails console --sandbox` could cause a database server to become out-of-memory as it's holding on to changes that happen on the database. Given that it's common for Ruby on Rails application with huge traffic to have separate write database and read database, we should allow the developers to disable this sandbox option to prevent someone from accidentally causing the Denial-of-Service on their server.
* | Merge pull request #35718 from ↵Yuji Yaginuma2019-03-241-1/+12
|\ \ | | | | | | | | | | | | y-yagi/add_secret_key_base_when_creating_new_credentials Add `secret_key_base` when creating new credential file
| * | Add `secret_key_base` when creating new credential fileyuuji.yaginuma2019-03-231-1/+12
| |/ | | | | | | | | | | | | | | Since `secret_key_base` is expected to be included in credential file, `secret_key_base` should be included even if re-create the file. This is the same behavior as creating a new app. When env is specified, it may be unnecessary, so I added it only when not specifying env.
* / Update comment for how secret key is calculatedJohn Hawthorn2019-03-221-1/+2
|/ | | | | | | This updates the comment to reflect how the secret key is generated since 4c743587ad6a31908503ab317e37d70361d49e66 Fixes #35717
* Use symbol for mail preview format, not stringJohn Hawthorn2019-03-181-1/+1
|
* Add -e/--environment option to `rails initializers`yuuji.yaginuma2019-03-161-0/+7
| | | | This allows specifying the environment as would any other rails commands.
* Properly expand the environment's name in all commandsyuuji.yaginuma2019-03-154-11/+21
| | | | | | | | | | | | | Since 3777701f1380f3814bd5313b225586dec64d4104, the environment's name is automatically expanded in console and dbconsole commands. In order to match the behavior between the commands, fixes it to have the same behavior of all the commands. This behavior is defined in `EnvironmentArgument`. Since `EnvironmentArgument` also defines the environment option, it is reused. However, since desc was not content that can be used in all comments, fixed desc to be defined for each command.
* Make application work without tmp directoryyuuji.yaginuma2019-03-141-0/+1
| | | | | | | | | | | | The tmp directory is added to version control in the newly created application. This was added in Rails 5.0.0(https://github.com/rails/rails/commit/f06ce4c12a396795a3b2c1812951d9277bcb3a82). However, applications created before that are not guaranteed to have the tmp directory. If the tmp directory does not exist, writing to the key file raise error. This is a bit incompatible. So I fixed that create the directory before writing a key.
* Merge tag 'v6.0.0.beta3'eileencodes2019-03-132-3/+18
|\ | | | | | | v6.0.0.beta3 release
| * Prep releaseeileencodes2019-03-111-1/+1
| | | | | | | | | | | | | | * Update RAILS_VERSION * Bundle * rake update_versions * rake changelog:header
| * Fix possible dev mode RCEAaron Patterson2019-03-101-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | If the secret_key_base is nil in dev or test generate a key from random bytes and store it in a tmp file. This prevents the app developers from having to share / checkin the secret key for dev / test but also maintains a key between app restarts in dev/test. [CVE-2019-5420] Co-Authored-By: eileencodes <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
* | Indentation >>Akira Matsuda2019-03-131-3/+3
| |
* | Fix rubocop violationsyuuji.yaginuma2019-03-131-1/+1
| |
* | overriden -> overridden [ci skip]Sharang Dashputre2019-03-121-1/+1
| |
* | Do not generate dummy string when the tag used is not the <%=Rafael Mendonça França2019-03-111-1/+4
| |
* | Merge pull request #34955 from bogdanvlviv/follow-up-33962Kasper Timm Hansen2019-03-111-1/+1
|\ \ | | | | | | Add `config.credentials.content_path` and `config.credentials.key_path` to the guide
| * | Add `config.credentials.content_path` and `config.credentials.key_path` to ↵bogdanvlviv2019-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | the guide - Fix some typos Follow up #33962
* | | [ci skip] Improve `encrypted` commands USAGEKasper Timm Hansen2019-03-111-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This streamlines the lovely foundation Bogdan added. Mainly to add guidance around encryption keys and remove some backticks. Finally it adds some mention of how to access these files from Ruby in apps. [ Kasper Timm Hansen & bogdanvlviv ]
* | | Merge pull request #34965 from bogdanvlviv/improve-rails-encrypted--helpKasper Timm Hansen2019-03-112-0/+23
|\ \ \ | | | | | | | | Improve output of `rails encrypted(:edit/:show) --help`
| * | | Improve output of `rails encrypted(:edit/:show) --help`bogdanvlviv2019-01-172-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | With these simple examples, It will be easier for users to figure out how to use these commands. Related to 68479d09ba6bbd583055672eb70518c1586ae534
* | | | Merge pull request #35568 from prathamesh-sonpatki/server_squishRyuta Kamizono2019-03-111-1/+1
|\ \ \ \ | | | | | | | | | | Squish the deprecation messages across the codebase
| * | | | Squish the deprecation messages across the codebasePrathamesh Sonpatki2019-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sample example -> Before: prathamesh@Prathameshs-MacBook-Pro-2 blog *$ rails server thin DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -u option instead. After: prathamesh@Prathameshs-MacBook-Pro-2 squish_app *$ rails server thin DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -u option instead.
* | | | | Merge pull request #35569 from prathamesh-sonpatki/env-varsKasper Timm Hansen2019-03-111-2/+2
|\ \ \ \ \ | | | | | | | | | | | | Mention `environment variable` instead of just `environment`