aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* depend on Zeitwerk 2.1.0Xavier Noria2019-04-096-25/+83
|
* Merge pull request #35903 from ryohashimoto/fix_upsert_method_commentप्रथमेश Sonpatki2019-04-091-1/+1
|\ | | | | [ci skip] Fix `#upsert` method comment
| * Fix upsert method commentRyo Hashimoto2019-04-091-1/+1
|/ | | | | Because this method only updates or inserts a single record like `insert` method.
* s/Travis/Buildkite/Matthew Draper2019-04-094-8/+8
|
* Merge pull request #34800 from mqchau/mysqlCountDeleteRowInLockMatthew Draper2019-04-092-1/+31
|\ | | | | Wrap Mysql count of deleted rows in lock block to avoid conflict in test
| * Wrap Mysql count of deleted rows in lock block to avoid conflict in testQuan Chau2019-04-082-1/+31
| |
* | Merge pull request #35887 from kamipo/argument_errorRyuta Kamizono2019-04-0910-18/+40
|\ \ | | | | | | Raise `ArgumentError` for invalid `:limit` and `:precision` like as other options
| * | Raise `ArgumentError` for invalid `:limit` and `:precision` like as other ↵Ryuta Kamizono2019-04-0710-18/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | options When I've added new `:size` option in #35071, I've found that invalid `:limit` and `:precision` raises `ActiveRecordError` unlike other invalid options. I think that is hard to distinguish argument errors and statement invalid errors since the `StatementInvalid` is a subclass of the `ActiveRecordError`. https://github.com/rails/rails/blob/c9e4c848eeeb8999b778fa1ae52185ca5537fffe/activerecord/lib/active_record/errors.rb#L103 ```ruby begin # execute any migration rescue ActiveRecord::StatementInvalid # statement invalid rescue ActiveRecord::ActiveRecordError, ArgumentError # `ActiveRecordError` except `StatementInvalid` is maybe an argument error end ``` I'd say this is the inconsistency worth fixing. Before: ```ruby add_column :items, :attr1, :binary, size: 10 # => ArgumentError add_column :items, :attr2, :decimal, scale: 10 # => ArgumentError add_column :items, :attr3, :integer, limit: 10 # => ActiveRecordError add_column :items, :attr4, :datetime, precision: 10 # => ActiveRecordError ``` After: ```ruby add_column :items, :attr1, :binary, size: 10 # => ArgumentError add_column :items, :attr2, :decimal, scale: 10 # => ArgumentError add_column :items, :attr3, :integer, limit: 10 # => ArgumentError add_column :items, :attr4, :datetime, precision: 10 # => ArgumentError ```
* | | Merge pull request #35890 from kamipo/except_table_name_from_columnRyuta Kamizono2019-04-097-49/+48
|\ \ \ | | | | | | | | Except `table_name` from column objects
| * | | Except `table_name` from column objectsRyuta Kamizono2019-04-087-49/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `table_name` was added at #23677 to detect whether serial column or not correctly. We can do that detection before initialize column object, it makes column object size smaller, and it probably helps column object de-duplication.
* | | | Merge pull request #35888 from ↵Eileen M. Uchitelle2019-04-081-8/+8
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | lxxxvi/documentation_change_foreign_keys_to_bigint_in_association_basics change `t.integer` to `t.bigint` where applicable
| * | | | change `t.integer` to `t.bigint` where applicablelxxxvi2019-04-071-8/+8
| | |/ / | |/| |
* | | | Merge pull request #35892 from ryohashimoto/bulk_insert_logsEileen M. Uchitelle2019-04-082-1/+53
|\ \ \ \ | | | | | | | | | | Improve log messages for #insert_all` / `#upsert_all` etc. methods
| * | | | Improve log messages for #insert_all` / `#upsert_all` / `#insert` / `#upsert ↵Ryo Hashimoto2019-04-082-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | etc. methods In #35077, `#insert_all` / `#upsert_all` / `#insert` / `#upsert` etc. methods are added. But Active Record logs only “Bulk Insert” log messages when they are invoked. This commit improves the log messages to use collect words for how invoked them.
* | | | | Merge pull request #35897 from soartec-lab/update_guide_engineRafael França2019-04-081-2/+2
|\ \ \ \ \ | | | | | | | | | | | | Update configuration of `app` directory and use oxford comma [skip ci]
| * | | | | Update configuration of `app` directory and use oxford comma [skip ci]soartec-lab2019-04-091-2/+2
| | | | | |
* | | | | | Merge pull request #35854 from boblail/fix-bug-with-insert_all-on-mysqlRyuta Kamizono2019-04-083-4/+42
|\ \ \ \ \ \ | |/ / / / / |/| | | | | When skipping duplicates in bulk insert on MySQL, avoid assigning an AUTONUMBER column when not specified
| * | | | | When skipping duplicates in bulk insert on MySQL, avoid assigning id when ↵Bob Lail2019-04-083-4/+42
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not specified If `id` is an `AUTONUMBER` column, then my former strategy here of assigning `no_op_column` to an arbitrary column would fail in this specific scenario: 1. `model.columns.first` is an AUTONUMBER column 2. `model.columns.first` is not assigned in the insert attributes I added three tests: the first test covers the actual error; the second test documents that this _isn't_ a problem when a value is given for the AUTONUMBER column and the third test ensures that this no-op strategy isn't secretly doing an UPSERT.
* | | | | Merge pull request #35883 from alexcameron89/add_ar_release_notesप्रथमेश Sonpatki2019-04-081-0/+227
|\ \ \ \ \ | |/ / / / |/| | | | [ci-skip] Add 6.0 Release Notes for Active Record
| * | | | [ci skip] Add 6.0 Release Notes for Active RecordAlex Kitchens2019-04-081-0/+227
| | |/ / | |/| |
* | | | Fix GROUP BY with calculate longer name field to respect `table_alias_length`Ryuta Kamizono2019-04-086-11/+30
| |/ / |/| | | | | | | | Follow up of c9e4c848eeeb8999b778fa1ae52185ca5537fffe.
* | | depend on Zeitwerk 2Xavier Noria2019-04-076-7/+28
|/ /
* | Don't repeat same expression in SELECT and GROUP BY clausesRyuta Kamizono2019-04-061-26/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This refactors `execute_grouped_calculation` and slightly changes generated GROUP BY queries, since I'd not prefer to repeat same expression in SELECT and GROUP BY clauses. Before: ``` SELECT COUNT(*) AS count_all, "topics"."author_name" AS topics_author_name, COALESCE(type, title) AS coalesce_type_title FROM "topics" GROUP BY "topics"."author_name", COALESCE(type, title) ``` After: ``` SELECT COUNT(*) AS count_all, "topics"."author_name" AS topics_author_name, COALESCE(type, title) AS coalesce_type_title FROM "topics" GROUP BY topics_author_name, coalesce_type_title ``` Although we generally don't guarantee to support Arel node constructed by user itself, this also fixes #24207.
* | There is no need to check `null_relation?` in `empty_scope?`Ryuta Kamizono2019-04-063-1/+8
| | | | | | | | `values[:extending]` includes `NullRelation` if `null_relation?`.
* | Association loading isn't to be affected by null relation scopingRyuta Kamizono2019-04-063-3/+31
| | | | | | | | | | | | Follow up of #35868. Closes #19349.
* | Merge pull request #35868 from ↵Ryuta Kamizono2019-04-064-8/+48
|\ \ | | | | | | | | | | | | kamipo/association_isnt_to_be_affected_by_scoping_consistently Association loading isn't to be affected by scoping consistently
| * | Association loading isn't to be affected by scoping consistentlyRyuta Kamizono2019-04-054-8/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up of 5c71000, #29834, and #30271. Currently, preloading and eager loading are not to be affected by scoping, with the exception of `unscoped`. But non eager loaded association access is still affected by scoping. Although this is a breaking change, the association loading will work consistently whether preloaded / eager loaded or not. Before: ```ruby Post.where("1=0").scoping do Comment.find(1).post # => nil Comment.preload(:post).find(1).post # => #<Post id: 1, ...> Comment.eager_load(:post).find(1).post # => #<Post id: 1, ...> end ``` After: ```ruby Post.where("1=0").scoping do Comment.find(1).post # => #<Post id: 1, ...> Comment.preload(:post).find(1).post # => #<Post id: 1, ...> Comment.eager_load(:post).find(1).post # => #<Post id: 1, ...> end ``` Fixes #34638. Fixes #35398.
* | | The default value without loading railtie is false [ci skip] (#35881)प्रथमेश Sonpatki2019-04-051-1/+1
| | | | | | | | | | | | | | | | | | See https://github.com/rails/rails/pull/35873#issuecomment-480333333 for reference [Prathamesh Sonpatki, bogdanvlviv]
* | | Merge pull request #35873 from prathamesh-sonpatki/enqueuing-fixesEileen M. Uchitelle2019-04-052-2/+2
|\ \ \ | | | | | | | | Fix the deprecation warning about `config.active_job.return_false_on_aborted_enqueue`
| * | | Fix the deprecation warning about ↵Prathamesh Sonpatki2019-04-052-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `config.active_job.return_false_on_aborted_enqueue` - It will return false in Rails 6.1 not 6.0. Also fixed the default value which is true for new applications.
* | | | Merge pull request #35876 from abhaynikam/fix-typo-for-touch-later-test-caseRyuta Kamizono2019-04-051-1/+1
|\ \ \ \ | | | | | | | | | | Fix typo for touch later test description. laster -> later
| * | | | Fix typo for touch later test description. laster -> laterAbhay Nikam2019-04-051-1/+1
|/ / / /
* | | | Add Active Job release notes [ci skip] (#35872)प्रथमेश Sonpatki2019-04-052-2/+48
| | | |
* | | | Merge pull request #35871 from kamipo/klass_level_touch_allRyuta Kamizono2019-04-053-2/+34
|\ \ \ \ | | | | | | | | | | Add missing `touch_all` delegation to relation
| * | | | Add missing `touch_all` delegation to relationRyuta Kamizono2019-04-053-2/+34
| | |/ / | |/| | | | | | | | | | Follow up of #31513.
* | | | Merge pull request #35870 from abhaynikam/mark-touch-later-as-private-docRyuta Kamizono2019-04-051-1/+1
|\ \ \ \ | |_|_|/ |/| | | [ci skip] Mark ActiveRecord::TouchLater as private doc
| * | | [ci skip] Mark ActiveRecord::TouchLater as private docAbhay Nikam2019-04-051-1/+1
|/ / /
* | | Merge pull request #35867 from y-yagi/do_not_exclude_paths_in_global_levelYuji Yaginuma2019-04-051-6/+0
|\ \ \ | |/ / |/| | Do not exclude paths in the global level of Code Climate
| * | Do not exclude paths in the global level of Code Climateyuuji.yaginuma2019-04-051-6/+0
|/ / | | | | | | | | | | | | | | We use only RuboCop in Code Climate and exclude paths are specified in RuboCop's setting. The global level excludes paths should not be specified to match the behavior of local and CodeClimate.
* | `preloaded_records` no longer includes `nil` since #35496Ryuta Kamizono2019-04-051-1/+0
| |
* | Bump addressable to 2.6.0 to fix warning: assigned but unused variable - ↵Ryuta Kamizono2019-04-051-1/+1
| | | | | | | | | | | | startercc https://github.com/sporkmonger/addressable/pull/270
* | `ast` is no longer to be `nil` since #33118Ryuta Kamizono2019-04-051-1/+0
| |
* | Remove duplicated `test_find_last`Ryuta Kamizono2019-04-051-5/+0
| | | | | | | | This is completely same with `test_last`.
* | Merge pull request #35864 from kamipo/improve_left_joinsRyuta Kamizono2019-04-056-32/+45
|\ \ | | | | | | Stash `left_joins` into `joins` to deduplicate redundant LEFT JOIN
| * | Stash `left_joins` into `joins` to deduplicate redundant LEFT JOINRyuta Kamizono2019-04-056-32/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally the `JoinDependency` has the deduplication for eager loading (LEFT JOIN). This re-uses that deduplication for `left_joins`. And also, This makes left join order into part of joins, i.e.: Before: ``` association joins -> stash joins (eager loading, etc) -> string joins -> left joins ``` After: ``` association joins -> stash joins (eager loading, left joins, etc) -> string joins ``` Now string joins are able to refer left joins. Fixes #34325. Fixes #34332. Fixes #34536.
* | | Merge pull request #35863 from urkle/fix-typo-in-guidesVipul A M2019-04-051-1/+1
|\ \ \ | | | | | | | | fix typo in the guides (use Rails instead of rails) [ci skip]
| * | | fix typo in the guides (use Rails instead of rails)Edward Rudd2019-04-041-1/+1
|/ / /
* | | Merge pull request #35861 from sharang-d/after_save_commit-callback-docVipul A M2019-04-051-2/+25
|\ \ \ | | | | | | | | Add documentation for 'after_save_commit' [ci skip]
| * | | Add documentation for 'after_save_commit' [ci skip]Sharang Dashputre2019-04-051-2/+25
|/ / /
* | | Merge pull request #35691 from ↵Rafael França2019-04-042-6/+78
|\ \ \ | | | | | | | | | | | | | | | | sushantmittal/add_deattach_from_in_active_support_subscriber Adds 'detach_from' to 'ActiveSupport::Subscriber' to detach a subscriber from a namespace.