aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | Merge pull request #33789 from nisusam/update_hijacking_linkYuji Yaginuma2018-09-041-2/+2
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Update link for `Rack socket hijacking API`
| * | | | | | Update link for `Rack socket hijacking API`nisusam2018-09-041-2/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | - Use valid `fragment identifier` in the URL - Use `https`
* | | | | | Merge pull request #33779 from mcnelson/update_changelog_for_null_storeKasper Timm Hansen2018-09-031-0/+4
|\ \ \ \ \ \ | | | | | | | | | | | | | | Update changelog with new default cache store in test env
| * | | | | | Update changelog with null_store defaultMichael Nelson2018-09-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | | Merge pull request #33673 from ↵Ryuta Kamizono2018-09-034-6/+31
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | | | | | | | | tgxworld/regression_setting_children_record_in_parent_before_save Fix regression setting children record in parent before_save callback.
| * | | | | | Fix regression setting children record in parent before_save callback.Guo Xiang Tan2018-09-034-6/+31
| | | | | | |
* | | | | | | Merge pull request #33773 from mcnelson/null_cache_store_for_test_envGeorge Claghorn2018-09-021-0/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Make null_store the default cache store in test environment config
| * | | | | | | Set cache store as null_store for test environmentMichael Nelson2018-08-021-0/+1
| | | | | | | |
* | | | | | | | Remove unused splat args in `_create_record`Ryuta Kamizono2018-09-022-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `_create_record` is passed `attribute_names` only. ``` % git grep -n '_create_record(attribute_names' lib/active_record/attribute_methods/dirty.rb:173: def _create_record(attribute_names = attribute_names_for_partial_writes) lib/active_record/counter_cache.rb:162: def _create_record(attribute_names = self.attribute_names) lib/active_record/locking/optimistic.rb:64: def _create_record(attribute_names = self.attribute_names) lib/active_record/persistence.rb:738: def _create_record(attribute_names = self.attribute_names) ```
* | | | | | | | Merge pull request #33774 from sharang-d/comment-changesRyuta Kamizono2018-09-023-6/+6
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change some comments to conform to the style used in other comments [ci skip]
| * | | | | | | | [ci skip] Change some comments to conform to the style used in other commentsSharang Dashputre2018-09-013-6/+6
| | | | | | | | |
* | | | | | | | | Merge pull request #33776 from gmcgibbon/extend-database-default-value-testRyuta Kamizono2018-09-023-3/+23
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | add mysql and sqlite3 default test
| * | | | | | | | add mysql and sqlite3 default testkenjiszk2018-09-013-3/+23
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | [Gannon McGibbon + Kenji Suzuki]
* | | | | | | | Merge pull request #33770 from eileencodes/multi-db-improvements-part-3Eileen M. Uchitelle2018-09-0110-30/+99
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Part 3: Multi-db Improvements, identifying replica configurations
| * | | | | | | | Convert configs_for to kwargs, add include_replicasEileen Uchitelle2018-08-318-30/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes the `configs_for` method from using traditional arguments to using kwargs. This is so I can add the `include_replicas` kwarg without having to always include `env_name` and `spec_name` in the method call. `include_replicas` defaults to false because everywhere internally in Rails we don't want replicas. `configs_for` is for iterating over configurations to create / run rake tasks, so we really don't ever need replicas in that case.
| * | | | | | | | Add replica? check to DatabaseConfigEileen Uchitelle2018-08-313-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Checks if the config has a "replica" key, if so the configuration is for a replica database. This is useful for excluding replicas from the configurations list when creating the rake tasks or running rake tasks. For example, we don't want to create the primary and primary_readonly. They're the same database.
| * | | | | | | | Add config option for `replica`.Eileen Uchitelle2018-08-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the user to add `replica: true` to the database config to signify the connection should be treated as readonly. This will be useful so we can ignore structure dumps or migrations (or creating / deleting etc) the readonly connection for the databases. These are paired with a write database which is where the create/drop/migrate should be run. This allows us to ask the connection if it's for a replica readonly db or a primary write db.
* | | | | | | | | Remove needless test order configyuuji.yaginuma2018-09-011-2/+0
| |_|/ / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were added for avoiding warnings and for testing in e4c529ea1d94ef548975e45b91a7fec045aeefbc and 6ea7065a18671872f1486cff3fdaeb4f78fa6332. Now the default is `:random`, and since the tests added with it are removed. That config is unnecessary.
* | | | | | | | Merge pull request #33743 from ↵Rafael França2018-08-312-15/+79
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | steakknife/steakknife/improve-template-generator-actions add github to template actions, template actions minor refactor
| * | | | | | | | add github to template actions, light DSL refactorBarry Allard2018-08-302-15/+79
| | | | | | | | |
* | | | | | | | | Merge pull request #33758 from schneems/schneems/faster_strong_paramsRichard Schneeman2018-08-312-8/+25
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Faster permitted_scalar_filter
| * | | | | | | | | Faster permitted_scalar_filterschneems2018-08-312-8/+25
| | |_|_|_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running with code triage and derailed benchmarks and focusing on this file: Before 16199 /Users/rschneeman/Documents/projects/rails/actionpack/lib/action_controller/metal/strong_parameters.r After 2280 /Users/rschneeman/Documents/projects/rails/actionpack/lib/action_controller/metal/strong_parameters.rb
* | | | | | | | | Merge pull request #33766 from yskkin/warn_pluralRafael França2018-08-314-3/+35
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | Emit warning for unknown inflection rule when generating model.
| * | | | | | | | Emit warning for unknown inflection rule when generating model.Yoshiyuki Kinjo2018-08-314-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For words like "abuse", Rails cannot derive its singular form from plural form "abuses" without defining custom inflection rule. `rails generate model` and its families now emit warning for this case.
* | | | | | | | | Remove redundant `travel_back`yuuji.yaginuma2018-08-312-7/+0
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Since #29860, `travel_back` automatically called at the end of the test.
* | | | | | | | Merge pull request #33762 from nicolasmlv/typoRyuta Kamizono2018-08-311-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Typo in form_helpers.md guide [ci skip]
| * | | | | | | | [ci skip] Typo in form helpers guideNicolas Maloeuvre2018-08-301-1/+1
|/ / / / / / / /
* | | | | | | | Merge pull request #33751 from steves/add_retry_notifications_to_ajRafael França2018-08-305-35/+152
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Add hooks to ActiveJob around retries and discards
| * | | | | | | | Move ActiveJob retry and discard logging into log subscriberSteve S2018-08-303-32/+103
| | | | | | | | |
| * | | | | | | | Add hooks to ActiveJob around retries and discardsSteve S2018-08-293-7/+53
| | | | | | | | |
* | | | | | | | | Just delegate `update` with ids on a relation to `klass.update`Ryuta Kamizono2018-08-312-2/+24
| |_|/ / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This restores an ability that `update` with ids on a relation which is described at https://github.com/rails/rails/issues/33470#issuecomment-411203013. I personally think that the `update` with two arguments on a relation is not a designed feature, since that is totally not using a relation state, and also is not documented. But removing any feature should not be suddenly happened in a stable version even if that is not documented.
* | | | | | | | Merge pull request #33637 from eileencodes/ar-connection-management-refactoringEileen M. Uchitelle2018-08-3021-255/+1192
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Refactor Active Record configurations
| * | | | | | | | Refactors Active Record connection managementEileen Uchitelle2018-08-3021-255/+1192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the three-tier config makes it easier to define databases for multiple database applications, it quickly became clear to offer full support for multiple databases we need to change the way the connections hash was handled. A three-tier config means that when Rails needed to choose a default configuration (in the case a user doesn't ask for a specific configuration) it wasn't clear to Rails which the default was. I [bandaid fixed this so the rake tasks could work](#32271) but that fix wasn't correct because it actually doubled up the configuration hashes. Instead of attemping to manipulate the hashes @tenderlove and I decided that it made more sense if we converted the hashes to objects so we can easily ask those object questions. In a three tier config like this: ``` development: primary: database: "my_primary_db" animals: database; "my_animals_db" ``` We end up with an object like this: ``` @configurations=[ #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbded10 @env_name="development",@spec_name="primary", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}>, #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbdea90 @env_name="development",@spec_name="animals", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}> ]> ``` The configurations setter takes the database configuration set by your application and turns them into an `ActiveRecord::DatabaseConfigurations` object that has one getter - `@configurations` which is an array of all the database objects. The configurations getter returns this object by default since it acts like a hash in most of the cases we need. For example if you need to access the default `development` database we can simply request it as we did before: ``` ActiveRecord::Base.configurations["development"] ``` This will return primary development database configuration hash: ``` { "database" => "my_primary_db" } ``` Internally all of Active Record has been converted to use the new objects. I've built this to be backwards compatible but allow for accessing the hash if needed for a deprecation period. To get the original hash instead of the object you can either add `to_h` on the configurations call or pass `legacy: true` to `configurations. ``` ActiveRecord::Base.configurations.to_h => { "development => { "database" => "my_primary_db" } } ActiveRecord::Base.configurations(legacy: true) => { "development => { "database" => "my_primary_db" } } ``` The new configurations object allows us to iterate over the Active Record configurations without losing the known environment or specification name for that configuration. You can also select all the configs for an env or env and spec. With this we can always ask any object what environment it belongs to: ``` db_configs = ActiveRecord::Base.configurations.configurations_for("development") => #<ActiveRecord::DatabaseConfigurations:0x00007fd1acbdf800 @configurations=[ #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbded10 @env_name="development",@spec_name="primary", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}>, #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbdea90 @env_name="development",@spec_name="animals", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}> ]> db_config.env_name => "development" db_config.spec_name => "primary" db_config.config => { "adapter"=>"sqlite3", "database"=>"db/development.sqlite3" } ``` The configurations object is more flexible than the configurations hash and will allow us to build on top of the connection management in order to add support for primary/replica connections, sharding, and constructing queries for associations that live in multiple databases.
* | | | | | | | | Merge pull request #33759 from schneems/schneems/move-variable-out-of-loopRichard Schneeman2018-08-301-2/+2
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Do not recompute length
| * | | | | | | | | Do not recompute lengthschneems2018-08-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can get a speed gain by moving the length calculation and assignment out of the loop.
* | | | | | | | | | Merge pull request #33760 from ↵Eileen M. Uchitelle2018-08-304-1/+28
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eileencodes/add-migrations_paths_option-to-migration-generator Add migrations_paths option to migration generator
| * | | | | | | | | | Add migrations_paths option to migration generatorEileen Uchitelle2018-08-304-1/+28
| | |/ / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds an option to the migration generator to allow setting the migrations paths for that migration. This is useful for applications that use multiple databases and put migrations per database in their own directories. ``` bin/rails g migration CreateHouses address:string --migrations-paths=db/kingston_migrate invoke active_record create db/kingston_migrate/20180830151055_create_houses.rb ```
* | | | | | | | | | Merge pull request #33761 from schneems/schneems/strong_params_docRichard Schneeman2018-08-301-0/+10
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | [ci skip] Document permitted_scalar_filter
| * | | | | | | | | | [ci skip] Document permitted_scalar_filterschneems2018-08-301-0/+10
|/ / / / / / / / / /
* | | | | | | | | | Refactor `attributes_for_{create,update}` to avoid an extra allocationRyuta Kamizono2018-08-312-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use `delete_if` instead of `reject` to avoid an extra allocation.
* | | | | | | | | | Remove `attributes_with_values_for_{create,update}` for internal useRyuta Kamizono2018-08-302-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `attributes_with_values_for_update` is no longer used since ae2d36c, and `attributes_with_values_for_create` is internally used only one place.
* | | | | | | | | | Remove extra `& self.class.column_names` in `keys_for_partial_write`Ryuta Kamizono2018-08-301-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It should be done only once in `Persistence` module. https://github.com/rails/rails/blob/c83e30da27eafde79164ecb376e8a28ccc8d841f/activerecord/lib/active_record/persistence.rb#L721 https://github.com/rails/rails/blob/c83e30da27eafde79164ecb376e8a28ccc8d841f/activerecord/lib/active_record/persistence.rb#L740
* | | | | | | | | | Merge pull request #33757 from bogdanvlviv/follow-up-32937Ryuta Kamizono2018-08-303-4/+16
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Follow up #32937 [ci skip]
| * | | | | | | | | | Add info about purpose in cookies to "Upgrading Ruby on Rails" guide [ci skip]bogdanvlviv2018-08-301-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Context https://github.com/rails/rails/pull/33605#discussion_r210354278 Related to #32937, #33605
| * | | | | | | | | | Add info about `config.action_dispatch.use_cookies_with_metadata` to ↵bogdanvlviv2018-08-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Configuring Rails Applications" guide [ci skip] Related to #32937, #33605.
| * | | | | | | | | | Fix `actionpack/CHANGELOG.md` [ci skip]bogdanvlviv2018-08-301-4/+2
|/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the reference to the PR. Usually, we write reference to solved issues in the changelog files. Related to #33605. Add missing dots. Improve formatting.
* | | | | | | | | | Add missing requireyuuji.yaginuma2018-08-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this, `inverse_associations_test.rb` breaks when running in isolation. https://travis-ci.org/rails/rails/jobs/422266840#L1894-L1899
* | | | | | | | | | Merge pull request #33729 from kddeisz/plural-automatic-inverseRafael França2018-08-292-5/+26
|\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / |/| | | | | | | | | Find inverse associations with plural names
| * | | | | | | | | Find inverse associations with plural namesKevin Deisz2018-08-272-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously ActiveRecord couldn't find inverse associations if they were plural, which is a pretty standard use case. This commit changes the behavior to first attempt to find the singular version, then attempt to find the plural version. That makes it work and find plural associations as in the example below: ``` class Post has_many :comments end class Comment belongs_to :post end ``` Previously the `:post` association reflection would only attempt to find a `comment` inverse, as opposed to both a `comment` and `comments` inverse.
* | | | | | | | | | Merge pull request #33752 from sgrif/sg-faster-tryRichard Schneeman2018-08-291-8/+7
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | 20% faster `try`