aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* activerecord: Fix where nil condition on composed_of attributeDylan Thacker-Smith2019-01-182-4/+23
|
* Merge pull request #30000 from ↵Ryuta Kamizono2019-01-1814-37/+72
|\ | | | | | | | | kamipo/all_of_queries_should_return_correct_result All of queries should return correct result even if including large number
| * Ensure `StatementCache#execute` never raises `RangeError`Ryuta Kamizono2019-01-187-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Since 31ffbf8d, finder methods no longer raise `RangeError`. So `StatementCache#execute` is the only place to raise the exception for finder queries. `StatementCache` is used for simple equality queries in the codebase. This means that if `StatementCache#execute` raises `RangeError`, the result could always be regarded as empty. So `StatementCache#execute` just return nil in that range error case, and treat that as empty in the caller side, then we can avoid catching the exception in much places.
| * All of queries should return correct result even if including large numberRyuta Kamizono2019-01-187-18/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently several queries cannot return correct result due to incorrect `RangeError` handling. First example: ```ruby assert_equal true, Topic.where(id: [1, 9223372036854775808]).exists? assert_equal true, Topic.where.not(id: 9223372036854775808).exists? ``` The first example is obviously to be true, but currently it returns false. Second example: ```ruby assert_equal topics(:first), Topic.where(id: 1..9223372036854775808).find(1) ``` The second example also should return the object, but currently it raises `RecordNotFound`. It can be seen from the examples, the queries including large number assuming empty result is not always correct. Therefore, This change handles `RangeError` to generate executable SQL instead of raising `RangeError` to users to always return correct result. By this change, it is no longer raised `RangeError` to users.
* | Merge pull request #34959 from alkesh26/action-cable-typo-fixesRafael França2019-01-183-3/+3
|\ \ | | | | | | Typo fixes in action cable.
| * | typo fixes in action cablealkesh262019-01-173-3/+3
| | |
* | | Merge pull request #34972 from krzysiek1507/fix/date-advance-performanceRafael França2019-01-181-5/+6
|\ \ \ | | | | | | | | Faster and better memory efficient Date#advance
| * | | No dup nor delete from optionsKrzysztof Rybka2019-01-181-5/+6
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Memory comparison: Options: {:years=>1, :months=>1, :weeks=>1, :days=>1} Calculating ------------------------------------- master 576.000 memsize ( 0.000 retained) 5.000 objects ( 0.000 retained) 0.000 strings ( 0.000 retained) advance_no_dup 288.000 memsize ( 0.000 retained) 4.000 objects ( 0.000 retained) 0.000 strings ( 0.000 retained) Comparison: advance_no_dup: 288 allocated master: 576 allocated - 2.00x more Options: {:years=>1} Calculating ------------------------------------- master 264.000 memsize ( 0.000 retained) 2.000 objects ( 0.000 retained) 0.000 strings ( 0.000 retained) advance_no_dup 72.000 memsize ( 0.000 retained) 1.000 objects ( 0.000 retained) 0.000 strings ( 0.000 retained) Comparison: advance_no_dup: 72 allocated master: 264 allocated - 3.67x more Options: {:weeks=>1} Calculating ------------------------------------- master 264.000 memsize ( 0.000 retained) 2.000 objects ( 0.000 retained) 0.000 strings ( 0.000 retained) advance_no_dup 72.000 memsize ( 0.000 retained) 1.000 objects ( 0.000 retained) 0.000 strings ( 0.000 retained) Comparison: advance_no_dup: 72 allocated master: 264 allocated - 3.67x more Peformance comparison: Options: {:years=>1, :months=>1, :weeks=>1, :days=>1} Warming up -------------------------------------- master 27.740k i/100ms advance_no_dup 37.705k i/100ms Calculating ------------------------------------- master 338.511k (± 5.9%) i/s - 1.692M in 5.020333s advance_no_dup 572.980k (± 3.7%) i/s - 2.866M in 5.008680s Comparison: advance_no_dup: 572979.7 i/s master: 338510.9 i/s - 1.69x slower Options: {:years=>1} Warming up -------------------------------------- master 53.313k i/100ms advance_no_dup 115.016k i/100ms Calculating ------------------------------------- master 639.715k (± 1.7%) i/s - 3.199M in 5.001851s advance_no_dup 1.579M (± 6.4%) i/s - 7.936M in 5.053876s Comparison: advance_no_dup: 1579251.7 i/s master: 639714.8 i/s - 2.47x slower Options: {:weeks=>1} Warming up -------------------------------------- master 57.353k i/100ms advance_no_dup 129.141k i/100ms Calculating ------------------------------------- master 674.113k (± 3.4%) i/s - 3.384M in 5.025973s advance_no_dup 1.911M (± 2.5%) i/s - 9.556M in 5.004496s Comparison: advance_no_dup: 1910739.3 i/s master: 674112.6 i/s - 2.83x slower
* | | Merge pull request #34969 from eileencodes/fix-error-message-for-multi-db-appsEileen M. Uchitelle2019-01-181-1/+20
|\ \ \ | |/ / |/| | Fix error message when adapter is not specified
| * | Fix error message when adapter is not specifiedEileen Uchitelle2019-01-171-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we added support for multiple databases through a 3-tiered config and configuration objects this error message got a bit convoluted. Previously if you had an application with a missing configuation and multiple databases the error message would look like this: ``` 'doesnexist' database is not configured. Available: development, development, test, test, production, production (ActiveRecord::AdapterNotSpecified) ``` That's not very descriptive since it duplicates the environments (because there are multiple databases per environment for this application). To fix this I've constructed a bit more readable error message which now reads like this if you have a multi db app: ``` The `doesntexist` database is not configured for the `production` environment. (ActiveRecord::AdapterNotSpecified) Available databases configurations are: development: primary, primary_readonly test: primary, primary_readonly production: primary, primary_readonly ``` And like this if you have a single db app: ``` The `doesntexist` database is not configured for the `production` environment. (ActiveRecord::AdapterNotSpecified) Available databases configurations are: development test ``` This makes the error message more readable and presents the user all available options for the database connections.
* | | Use `unboundable?` rather than `boundable?`Ryuta Kamizono2019-01-184-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `unboundable?` behaves like the `infinite?`. ```ruby inf = Topic.predicate_builder.build_bind_attribute(:id, Float::INFINITY) inf.infinite? # => 1 oob = Topic.predicate_builder.build_bind_attribute(:id, 9999999999999999999999999999999) oob.unboundable? # => 1 inf = Topic.predicate_builder.build_bind_attribute(:id, -Float::INFINITY) inf.infinite? # => -1 oob = Topic.predicate_builder.build_bind_attribute(:id, -9999999999999999999999999999999) oob.unboundable? # => -1 ```
* | | Revert "Remove deprecated `server` argument from the rails server command"yuuji.yaginuma2019-01-183-6/+25
| | | | | | | | | | | | | | | | | | This reverts commit fa791fb8e2a718b5d0430c7ca5a454678dfc192d. Reason: `server` argument was deprecated in Rails 6.0. Ref: #32058.
* | | Merge pull request #34956 from kamipo/actionmailbox_datetime_precisionRyuta Kamizono2019-01-184-14/+20
|\ \ \ | | | | | | | | Allow using Action Mailbox on MySQL 5.5
| * | | Allow using Action Mailbox on MySQL 5.5Ryuta Kamizono2019-01-184-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Active Record still support MySQL 5.5 which doesn't support datetime with precision. https://github.com/rails/rails/blob/9e34df00039d63b5672315419e76f06f80ef3dc4/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L99-L101 So we should check `supports_datetime_with_precision?` on the connection.
* | | | Merge pull request #34963 from ↵Rafael França2019-01-172-8/+13
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | dylanahsmith/better-composed-of-single-field-query activerecord: Use a simpler query condition for aggregates with one mapping
| * | | | Use public_send instead since respond_to? doesn't include private/protected ↵Ryuta Kamizono2019-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | methods by default Co-Authored-By: dylanahsmith <dylan.smith@shopify.com>
| * | | | Avoid using yield_self to make it easier to backportDylan Thacker-Smith2019-01-171-5/+4
| | | | |
| * | | | activerecord: Use a simpler query condition for aggregates with one mappingDylan Thacker-Smith2019-01-172-8/+14
| | | | |
* | | | | Action Text: bundle package.json in built gem.Kasper Timm Hansen2019-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After 866da19fd9fc12d001ab99ac87890ea1cebb2cd9 we now use package.json to install Action Text's JS dependencies (see JS_PACKAGE_PATH). But when the gem pacakge for Action Text is built, package.json was not included so running `rails action_text:install` in a Rails app would fail with: ``` rails action_text:install rails aborted! Errno::ENOENT: No such file or directory @ rb_sysopen - xxx/gems/actiontext-6.0.0.alpha/lib/templates/../../package.json ./bin/rails:4:in `<main>' Tasks: TOP => app:template (See full trace by running task with --trace) ```
* | | | | Use released webpackerRafael Mendonça França2019-01-173-12/+7
| | | | |
* | | | | Merge pull request #34966 from ↵Rafael Mendonça França2019-01-173-4/+14
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bogdanvlviv/ensure-ar-relation-exists-allows-permitted-params Ensure that AR::Relation#exists? allows only permitted params
| * | | | | Ensure that AR::Relation#exists? allows only permitted paramsbogdanvlviv2019-01-173-7/+17
| |/ / / / | | | | | | | | | | | | | | | | | | | | Clarify changelog entry Related to #34891
* | | | | Merge pull request #34954 from rails/rm-remove-5.2-deprecationsRafael França2019-01-1767-1189/+210
|\ \ \ \ \ | |_|/ / / |/| | | | Remove all code deprecated in Rails 5.2
| * | | | Remove deprecated `after_bundle` helper inside plugins templatesRafael Mendonça França2019-01-175-53/+16
| | | | |
| * | | | Remove deprecated `server` argument from the rails server commandRafael Mendonça França2019-01-173-25/+6
| | | | |
| * | | | Remove deprecated support to old `config.ru` that use the application class ↵Rafael Mendonça França2019-01-173-27/+4
| | | | | | | | | | | | | | | | | | | | as argument of `run`
| * | | | Remove deprecated `environment` argument from the rails commandsRafael Mendonça França2019-01-175-55/+10
| | | | |
| * | | | Remove deprecated `capify!`Rafael Mendonça França2019-01-173-18/+4
| | | | |
| * | | | Remove secret_token rack env and cookie upgrade codeRafael Mendonça França2019-01-177-261/+19
| | | | | | | | | | | | | | | | | | | | Now that secret_token was removed all this code is now dead.
| * | | | Remove deprecated `config.secret_token`Rafael Mendonça França2019-01-177-233/+13
| | | | |
| * | | | Remove deprecated `Module#reachable?` methodRafael Mendonça França2019-01-174-58/+5
| | | | |
| * | | | Remove deprecated `#acronym_regex` method from `Inflections`Rafael Mendonça França2019-01-174-9/+5
| | | | |
| * | | | Remove deprecated `#set_state` from the transaction objectRafael Mendonça França2019-01-173-29/+4
| | | | |
| * | | | Remove deprecated `#supports_statement_cache?` from the database adaptersRafael Mendonça França2019-01-173-11/+4
| | | | |
| * | | | Remove deprecated `#insert_fixtures` from the database adaptersRafael Mendonça França2019-01-175-43/+5
| | | | |
| * | | | Remove deprecated ↵Rafael Mendonça França2019-01-173-9/+4
| | | | | | | | | | | | | | | | | | | | `ActiveRecord::ConnectionAdapters::SQLite3Adapter#valid_alter_table_type?`
| * | | | Do not allow passing the column name to `sum` when a block is passedRafael Mendonça França2019-01-173-9/+11
| | | | |
| * | | | Do not allow passing the column name to `count` when a block is passedRafael Mendonça França2019-01-173-9/+11
| | | | |
| * | | | Remove delegation of missing methods in a relation to arelRafael Mendonça França2019-01-173-20/+4
| | | | |
| * | | | Remove delegation of missing methods in a relation to private methods of the ↵Rafael Mendonça França2019-01-173-12/+4
| | | | | | | | | | | | | | | | | | | | class
| * | | | Change `SQLite3Adapter` to always represent boolean values as integersRafael Mendonça França2019-01-178-109/+44
| | | | |
| * | | | Remove ability to specify a timestamp name for `#cache_key`Rafael Mendonça França2019-01-174-31/+10
| | | | |
| * | | | Remove deprecated `ActiveRecord::Migrator.migrations_path=`Rafael Mendonça França2019-01-173-17/+4
| | | | |
| * | | | Remove deprecated `expand_hash_conditions_for_aggregates`Rafael Mendonça França2019-01-173-46/+7
| | | | |
| * | | | Remove deprecated image_alt helperRafael Mendonça França2019-01-173-43/+4
| | | | |
| * | | | Remove deprecated `fragment_cache_key` helper in favor of ↵Rafael Mendonça França2019-01-173-27/+4
| | | | | | | | | | | | | | | | | | | | `combined_fragment_cache_key`
| * | | | Remove deprecated methods in ActionDispatch::TestResponseRafael Mendonça França2019-01-173-34/+7
| | | | | | | | | | | | | | | | | | | | | | | | | `#success?`, `missing?` and `error?` were deprecated in Rails 5.2 in favor of `#successful?`, `not_found?` and `server_error?`.
| * | | | Update the promisse that ActionController::TestCase will be extractedRafael Mendonça França2019-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are past 5.1 and it was not extrated yet, so while we still have plans they will not be realized on 6.0, so it is better to not set expectations of which release will exclude it just yet. [ci skip]
* | | | | Merge pull request #34967 from lifo/am-handle-duplicate-emailsGeorge Claghorn2019-01-174-10/+9
|\ \ \ \ \ | |/ / / / |/| | | | Update test schema.rb to reflect the recent changes
| * | | | Use create_and_extract_message_id! to create an inbound email.Pratik Naik2019-01-171-2/+1
| | | | | | | | | | | | | | | | | | | | This makes sure the created email has checksum and message id columns set.