aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #33657 from jychen7/fix-test-association-enumRyuta Kamizono2018-08-201-0/+3
|\ | | | | Improve test case to test enum correctly
| * Improve test case to test enum correctlyRich2018-08-201-0/+3
| | | | | | | | | | | | without define the enum in class “SpecialBook”, any string status will be casted to integer 0. Then the test have no meaning. [Rich Chen]
* | SQLite3: Fix rename reference column not to lose foreign key constraintRyuta Kamizono2018-08-202-11/+31
|/ | | | Fixes #33520.
* Address intermittent CI failure due to non-determined sort orderRyuta Kamizono2018-08-191-1/+1
| | | | https://travis-ci.org/rails/rails/jobs/417783260#L1173-L1179
* Ensure `foreign_keys` assertions after alter tableRyuta Kamizono2018-08-191-1/+5
| | | | | If `foreign_keys` is fetched before alter table, it couldn't notice whether foreign keys are broken or not after alter table.
* Enable Style/ParenthesesAroundCondition copRyuta Kamizono2018-08-191-1/+1
| | | | To prevent style check in review like https://github.com/rails/rails/pull/33608#discussion_r211087605.
* Merge pull request #33585 from yahonda/diag33520Ryuta Kamizono2018-08-163-1/+26
|\ | | | | | | SQLite3 adapter `alter_table` method restores foreign keys
| * SQLite3 adapter `alter_table` method restores foreign keysYasuo Honda2018-08-113-1/+26
| | | | | | | | Related to #33520
* | Merge pull request #33603 from kamipo/fix_numericality_validatorRyuta Kamizono2018-08-163-2/+26
|\ \ | | | | | | Fix numericality validator not to be affected by custom getter
| * | Fix numericality validator not to be affected by custom getterRyuta Kamizono2018-08-133-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since fe9547b6, numericality validator would parse raw value only when a value came from user to work type casting to a value from database. But that was caused a regression that the validator would work against getter value instead of parsed raw value, a getter is sometimes customized by people. #33550 There we never guarantees that the value before type cast was going to the used in this validation (actually here is only place that getter value might not be used), but we should not change the behavior unless there is some particular reason. The purpose of fe9547b6 is to work type casting to a value from database. We could achieve the purpose by using `read_attribute`, without using getter value. Fixes #33550.
* | | Merge pull request #33499 from lsylvester/caller-ignore-pathsKasper Timm Hansen2018-08-152-9/+9
|\ \ \ | | | | | | | | use BacktraceCleaner for ActiveRecord verbose logging
| * | | Use backtrace cleaner to clean up backtrace for verbose query logsLachlan Sylvester2018-08-142-9/+9
| |/ /
* | | Fix bulk change table ignores comment option on PostgreSQL.Yoshiyuki Kinjo2018-08-152-3/+16
| | |
* | | Follow up #33530bogdanvlviv2018-08-153-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Move changelog entry of #33530 up in order to preserve the chronology since we always add new entries on the top of a changelog file. - Clarify the changelog entry - Clarify the docs of remove_foreign_key - Ensure reversible of `remove_foreign_key` with `:primary_key` and `:to_table` options.
* | | Merge pull request #33530 from jychen7/33515-invert-remove-foreign-keyRichard Schneeman2018-08-144-4/+36
|\ \ \ | | | | | | | | 33515 invert remove foreign key support "to_table"
| * | | Allow `to_table` in `invert_remove_foreign_key`Rich2018-08-144-4/+36
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | remove_foreign_key supports - remove_foreign_key :accounts, :branches - remove_foreign_key :accounts, to_table: :branches but the second one is not reversible. This branch is to fix and allow second one to be reversible. [Nikolay Epifanov, Rich Chen]
* / / Use `Array#extract!` where possiblebogdanvlviv2018-08-142-8/+12
|/ /
* / Use strings instead of symbols on calls to decorate_matching_attribute_typesDillon Welch2018-08-102-2/+2
|/ | | | | | The first thing this method does is run on the argument. This change passes in a string so we don't allocate a bunch of unnecessary extra strings by calling to_s on a symbol over and over.
* Fix a wrong correctionKazuhiro Sera2018-08-081-1/+1
|
* Fix the obvious typos detected by github.com/client9/misspellKazuhiro Sera2018-08-085-16/+16
|
* Merge pull request #33454 from azbshiri/extend-affects-nested-attributesRichard Schneeman2018-08-043-2/+20
|\ | | | | Call build when extend with nested attributes defined
| * Call build when extend with nested attributes definedAlireza Bashiri2018-08-023-2/+20
| | | | | | | | | | | | | | | | What? From now on when `accepts_nested_attributes_for` defined and `extend` option added the overwritten `build` method being called. [Alireza Bashiri, Martins Polakovs]
* | Merge pull request #33511 from ↵Richard Schneeman2018-08-043-4/+4
|\ \ | | | | | | | | | | | | albertoalmagro/change-references-from-rake-to-rails-command Change references from Rake task to Rails command
| * | [ci skip] Change references from Rake task to Rails commandAlberto Almagro2018-08-013-4/+4
| | | | | | | | | | | | | | | This commit follows the path we started at commit #ea4f0e2 and continued at PR #33229.
* | | `retrieve_connection_pool` return a pool, not a connectionRyuta Kamizono2018-08-031-2/+2
| |/ |/|
* | don't establish connection test_database since it gets established in ↵Britni Alexander2018-08-011-1/+0
|/ | | | load_schema
* use load_schema instead of migrate for parallel testingBritni Alexander2018-07-312-6/+9
|
* Revert "Merge pull request #24131 from brchristian/limit_and_primary_key"Ryuta Kamizono2018-08-013-22/+1
| | | | | | | | | | This reverts commit d162188dd662a7d9f62ba8431474f50bc35e3e93, reversing changes made to 3576782888c307e3e192c44e332b957cd1174128. Reason: #24131 conflicts the #5153's default order contract, it means that existing apps would be broken by that change. We don't want to break existing apps without a deprecation cycle.
* Add test case for the #5153's default order contractRyuta Kamizono2018-08-011-0/+13
|
* Avoid extra scoping when using `Relation#update`Ryuta Kamizono2018-07-313-3/+9
| | | | | | | | | | | | | | Since 9ac7dd4, class level `update`, `destroy`, and `delete` were placed in the `Persistence` module as class methods. But `Relation#update` without passing ids which was introduced at #11898 is not a class method, and it was caused the extra scoping regression #33470. I moved the relation method back into the `Relation` to fix the regression. Fixes #33470.
* MySQL: Raise ActiveRecord::InvalidForeignKey for foreign-key constraint ↵George Claghorn2018-07-303-7/+20
| | | | violations on delete
* Extract `Relation#bind_attribute` for internal useRyuta Kamizono2018-07-302-8/+11
| | | | To make it easier to construct boundable predicate.
* Extract `Relation#update_counters` for internal useRyuta Kamizono2018-07-304-34/+27
| | | | | | The target object for counter cache is not always determined by the primary key value on the model. I'd like to extract `update_couters` onto the `Relation` for the internal use.
* Fix TypeError: no implicit conversion of Arel::Attributes::Attribute into StringBart de Water2018-07-281-1/+1
|
* Fix test failures due to Performance/RegexpMatch correctionBart de Water2018-07-281-1/+3
| | | | `5 =~ /\d/` returns nil, but Integer doesn't have a `match?` method.
* Enable Start/EndWith and RegexpMatch copsBart de Water2018-07-282-2/+2
| | | | | In cases where the MatchData object is not used, this provides a speed-up: https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
* Don't expose configuration for a test.Kasper Timm Hansen2018-07-282-23/+12
| | | | Clean up some concepts in the code while we're here.
* Avoid logging ActiveRecord::LogSubscriber as the query source when the ↵lsylvester2018-07-282-12/+22
| | | | source is ignored (#33455)
* PostgreSQL 10 new relkind for partitioned tables (#31336)Yannick Schutz2018-07-272-2/+24
| | | | | | | | | | | | | | | | | | | | | | | * PostgreSQL 10 new relkind for partitioned tables Starting with PostgreSQL 10, we can now have partitioned tables natively * Add comment * Remove extra space * Add test for partition table in postgreSQL10 * Select 'p' for "BASE TABLE" and add a test case to support PostgreSQL 10 partition tables * Address RuboCop offense * Addressed incorrect `postgresql_version` Fixes #33008. [Yannick Schutz & Yasuo Honda & Ryuta Kamizono]
* Remove Rubocop's comments from Rails code basebogdanvlviv2018-07-261-1/+1
| | | | | | | | | | PR#32381 added Rubocop's comments to some tests files in order to exclude `Performance/RedundantMerge`. Turn off `Performance` cops for tests files via `Exclude` in `.rubocop.yml`. Context https://github.com/rails/rails/pull/32381#discussion_r205212331
* Merge pull request #32381 from q-centrix/update-codeclimate-configsRichard Schneeman2018-07-258-31/+19
|\ | | | | Turn on performance based cops
| * Turn on performance based copsDillon Welch2018-07-238-31/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation
* | Normalize time value not to be affected by summer timeRyuta Kamizono2018-07-253-10/+41
| | | | | | | | Follow up of #33358 for SQLite3.
* | Merge pull request #33229 from ↵Matthew Draper2018-07-252-7/+7
|\ \ | | | | | | | | | | | | albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails Prefer rails command over bin/rails
| * | Substitute references to task for commandAlberto Almagro2018-07-061-1/+1
| | | | | | | | | | | | This commit substitutes references to rails/rake task for rails command
| * | Recommend use of rails over bin/railsAlberto Almagro2018-07-062-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together.
* | | Rails guides are now served over httpsPaul McMahon2018-07-241-1/+1
| |/ |/| | | | | | | http links will be redirected to the https version, but still better to just directly link to the https version.
* | Merge pull request #30919 from seanlinsley/17622-before_save_strict_argumentsRyuta Kamizono2018-07-231-0/+27
|\ \ | | | | | | | | | Add strict argument checking to ActiveRecord callbacks
| * | add strict argument checking to ActiveRecord callbacksSean Linsley2018-07-221-0/+23
|/ / | | | | | | This ends up adding it to all save-related callbacks defined in `ActiveRecord::DefineCallbacks`, including e.g. `after_create`. Which should be fine: they didn't support `:on` in the first place.
* | Merge pull request #33415 from orhantoy/feature/docs-consistent-hash-syntaxGeorge Claghorn2018-07-221-8/+8
|\ \ | | | | | | [ci skip] Use consistent hash syntax in AR docs