aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge pull request #34233 from lucasprag/update_guideYuji Yaginuma2018-10-171-1/+1
|\ \ \ | | | | | | | | Update guide for the counter variable when rendering with the `as:` option
| * | | Update guide for the counter variable when rendering with the `as:` optionLucas Oliveira2018-10-161-1/+1
| | | | | | | | | | | | | | | | [ci skip]
* | | | Consolidate duplicated code that initializing an empty model objectRyuta Kamizono2018-10-172-20/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `init_with` and `init_from_db` are almost the same code except decode `coder`. And also, named `init_from_db` is a little misreading, a raw values hash from the database is already converted to an attributes object by `attributes_builder.build_from_database`, so passed `attributes` in that method is just an attributes object. I renamed that method to `init_with_attributes` since the method is shared with `init_with` to initialize an empty model object.
* | | | Merge pull request #34232 from kamipo/check_versionRyuta Kamizono2018-10-174-27/+29
|\ \ \ \ | |/ / / |/| | | Consistently extract checking version for all adapters
| * | | Consistently extract checking version for all adaptersRyuta Kamizono2018-10-174-27/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't prefer to extract it for one adapter even though all adapters also does. Related to #34227.
* | | | Refactor Chars#reverse and Chars#grapheme_lengthFrancesco Rodríguez2018-10-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use \X meta character directly to get grapheme clusters. Thanks to @mtsmfm for the tip: https://github.com/rails/rails/pull/34123#issuecomment-429028878 r? @jeremy
* | | | Merge pull request #34231 from brasscapon/rails_fiveGannon McGibbon2018-10-161-1/+1
|\ \ \ \ | |/ / / |/| | | Fix mapping of content [ci skip]
| * | | Fix mapping of contentAdam Demirel2018-10-171-1/+1
| | | |
* | | | Merge pull request #34227 from bkuhlmann/master-lazy_mysql_version_check_supportAaron Patterson2018-10-161-4/+11
|\ \ \ \ | | | | | | | | | | Refactored abstract MySQL adapter to support lazy version check.
| * | | | Refactored abstract MySQL adapter to support lazy version check.Brooke Kuhlmann2018-10-161-4/+11
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Will allow sub classes to override the protected `#check_version` method hook if desired. For example, this will be most helpful in sub classes that wish to support lazy initialization because the version check can be postponed until the connection is ready to be initialized.
* | | | Merge pull request #34220 from bogdanvlviv/follow-up-33571Gannon McGibbon2018-10-161-3/+3
|\ \ \ \ | | | | | | | | | | Clarify docs of `ActiveJob::TestHelper` [ci skip]
| * | | | Clarify docs of `ActiveJob::TestHelper` [ci skip]bogdanvlviv2018-10-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found a few sentences that should be updated as well. See https://github.com/rails/rails/pull/33571#discussion_r209435886 Follow up #33571
* | | | | Merge pull request #34203 from ↵Ryuta Kamizono2018-10-161-0/+12
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | albertoalmagro/add-habtm-singular-ids-regression-test Add regression test against has_and_belong_to_many memoized singular_ids
| * | | | | Add regression test against habtm memoized singular_idsAlberto Almagro2018-10-161-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting in Rails 5.0.0 and still present in Rails 5.2.1, `singular_ids` got memoized and didn't reload after more items were added to the relation. Although 19c8071 happens to fix the issue, it only adds tests for `has_many` relations while this bug only affected `has_and_belongs_to_many` relations. This commit adds a regression test to ensure it never happens again with `habtm` relations. Ensures #34179 never gets reproduced.
* | | | | | Merge pull request #34056 from CaDs/CaDs-extend_documentation_for_fetch_multiRichard Schneeman2018-10-161-2/+11
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Extend doc for ActiveSupport::Cache#fetch_multi
| * | | | | Extends documentation for ActiveSupport::Cache#fetch_multi [ci skip]Carlos Donderis2018-10-161-2/+11
| | | | | |
* | | | | | Merge pull request #29204 from ↵Ryuta Kamizono2018-10-164-5/+21
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RasPat1/issue-29200-scaffold-reference-display-memory-address Issue #29200 scaffold an object with a reference displays an object memory address to user
| * | | | | | Show object ids in scaffold pages when displaying referenced objectsRasesh Patel2018-10-144-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolve Issue#29200 When scaffolding a model that references another model the generated show and index html pages display the object directly on the page. Basically, it just shows a memory address. That is not very helpful. In this commit we show the object's id rather than the memory address. This updates the scaffold templates and the json builder files.
* | | | | | | Merge pull request #33075 from ↵Ryuta Kamizono2018-10-163-2/+22
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | fedxgibson/pg_ambigous_column_cache_key_limit_custom_select Fix Collection cache key with limit and custom select
| * | | | | | Fix Collection cache key with limit and custom select (PG:AmbigousColumn: Error)Federico Martinez2018-10-153-2/+22
|/ / / / / / | | | | | | | | | | | | | | | | | | Change query to use alias name for timestamp_column to avoid ambiguity problems when using timestamp from subquery.
* | | | | | Deprecate ActiveSupport::Multibyte::Chars.consumes?Francesco Rodríguez2018-10-153-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In favor of String#is_utf8?. I think this method was made for internal use only, and its usage was removed here: https://github.com/rails/rails/pull/8261/files#diff-ce956ebe93786930e40f18db1da5fd46L39.
* | | | | | Merge pull request #34214 from brasscapon/rails_fiveRyuta Kamizono2018-10-151-1/+1
|\ \ \ \ \ \ | |_|_|/ / / |/| | | / / | | |_|/ / | |/| | | Update snippet to rails 5 syntax [ci skip]
| * | | | Update snippet to rails 5 syntaxAdam Demirel2018-10-151-1/+1
| | | | |
* | | | | Fix `ActionController::Parameters#each_value` and add changelog entry to ↵Bogdan2018-10-153-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this method (#34210) * Fix `ActionController::Parameters#each_value` `each_value` should yield with "value" of the params instead of "value" as an array. Related to #33979 * Add changelog entry about `ActionController::Parameters#each_value`. Follow up #33979
* | | | | Merge pull request #34135 from Edouard-chin/ec-rounded-durationAndrew White2018-10-153-3/+12
|\ \ \ \ \ | | | | | | | | | | | | Fix issue where duration where always rounded up to a second:
| * | | | | Fix issue where duration where always rounded up to a second:Edouard CHIN2018-10-123-3/+12
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Adding a Float as a duration to a datetime would result in the Float being rounded. Doing something like would have no effect because the 0.45 seconds would be rounded to 0 second. ```ruby time = DateTime.parse("2018-1-1") time += 0.45.seconds ``` This behavior was intentionally added a very long time ago, the reason was because Ruby 1.8 was using `Integer#gcd` in the constructor of Rational which didn't accept a float value. That's no longer the case and doing `Rational(0.45, 86400)` would now perfectly work fine. - Fixes #34008
* | | | | Ensure to test that `project.developers` is ordered by `developers.name desc`Ryuta Kamizono2018-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `developers.name desc` was added at d59f3a7, but any test case isn't failed even if the `developers.name desc` is removed since all tested developers are consistently ordered on both `name` and `id`. I changed one developers creation ordering to ensure to test that `project.developers` is ordered by `developers.name desc`.
* | | | | Merge pull request #34209 from y-yagi/fix_tests_on_mail_271Yuji Yaginuma2018-10-152-5/+5
|\ \ \ \ \ | |/ / / / |/| | | | Fix tests on Mail 2.7.1
| * | | | Fix tests on Mail 2.7.1yuuji.yaginuma2018-10-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up to `2.7.0`, encoding was chosen using `Mail::Encodings::TransferEncoding.negotiate`, and base64 encoding was used. In `2.7.1`, when `transfer_encoding` is not specified, the encoding of the message is respected. Related to: https://github.com/mikel/mail/commit/dead487e02f592d9058fd07deedcde39b569d18d However, what chosen for transfer encoding is not essential in these tests. To test more accurately, confirm that the decoded body instead.
| * | | | Bump mail to `2.7.1`yuuji.yaginuma2018-10-141-1/+1
|/ / / /
* | | | Improve model attribute accessor method names for backtracesDylan Thacker-Smith2018-10-125-75/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ruby uses the original method name, so will show the __temp__ method name in the backtrace. However, in the common case the method name is compatible with the `def` keyword, so we can avoid the __temp__ method name in that case to improve the name shown in backtraces or TracePoint#method_id.
* | | | Deprecate Unicode#normalize and Chars#normalize (#34202)Francesco Rodríguez2018-10-127-122/+212
| | | |
* | | | Merge pull request #34123 from frodsan/deprecate_unicode_string_wrappersJeremy Daer2018-10-124-41/+23
|\ \ \ \ | | | | | | | | | | Deprecate Unicode#downcase/upcase/swapcase.
| * | | | Use native String#capitalizeFrancesco Rodríguez2018-10-122-9/+2
| | | | |
| * | | | Deprecate Unicode#downcase/upcase/swapcase.Francesco Rodríguez2018-10-124-33/+22
| | | | | | | | | | | | | | | | | | | | Use String methods directly instead.
* | | | | Runs the generator before assertionsyuuji.yaginuma2018-10-121-0/+1
|/ / / /
* | | | Test that nested structs to_json works as expectedEileen Uchitelle2018-10-111-0/+10
| | | | | | | | | | | | | | | | | | | | Check that options passed to the to_json are passed to all objects that respond to as_json.
* | | | Merge pull request #34185 from gmcgibbon/test_retryRafael França2018-10-114-2/+9
|\ \ \ \ | |/ / / |/| | | Add test retries for railties
| * | | Include test gems in CIGannon McGibbon2018-10-111-1/+1
| | | |
| * | | Add test retries for railtiesGannon McGibbon2018-10-113-1/+8
|/ / /
* | | Merge pull request #34189 from orhantoy/fix-link-to-concurrent-ruby-docsKasper Timm Hansen2018-10-111-1/+1
|\ \ \ | | | | | | | | [ci skip] Fix link to Concurrent::ThreadPoolExecutor docs
| * | | [ci skip] Fix link to Concurrent::ThreadPoolExecutor docsOrhan Toy2018-10-111-1/+1
|/ / /
* | | Merge pull request #34188 from yskkin/remove_commentRyuta Kamizono2018-10-111-2/+0
|\ \ \ | | | | | | | | Remove invalid magic comment [ci skip]
| * | | Remove invalid magic comment [ci skip]Yoshiyuki Kinjo2018-10-111-2/+0
|/ / /
* | | Merge pull request #34052 from eileencodes/connection-switchingEileen M. Uchitelle2018-10-104-1/+328
|\ \ \ | | | | | | | | Part 4: Multi db improvements, Basic API for connection switching
| * | | Basic API for connection switchingEileen Uchitelle2018-10-104-1/+328
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR adds the ability to 1) connect to multiple databases in a model, and 2) switch between those connections using a block. To connect a model to a set of databases for writing and reading use the following API. This API supercedes `establish_connection`. The `writing` and `reading` keys represent handler / role names and `animals` and `animals_replica` represents the database key to look up the configuration hash from. ``` class AnimalsBase < ApplicationRecord connects_to database: { writing: :animals, reading: :animals_replica } end ``` Inside the application - outside the model declaration - we can switch connections with a block call to `connected_to`. If we want to connect to a db that isn't default (ie readonly_slow) we can connect like this: Outside the model we may want to connect to a new database (one that is not in the default writing/reading set) - for example a slow replica for making slow queries. To do this we have the `connected_to` method that takes a `database` hash that matches the signature of `connects_to`. The `connected_to` method also takes a block. ``` AcitveRecord::Base.connected_to(database: { slow_readonly: :primary_replica_slow }) do ModelInPrimary.do_something_thats_slow end ``` For models that are already loaded and connections that are already connected, `connected_to` doesn't need to pass in a `database` because you may want to run queries against multiple databases using a specific role/handler. In this case `connected_to` can take a `role` and use that to swap on the connection passed. This simplies queries - and matches how we do it in GitHub. Once you're connected to the database you don't need to re-connect, we assume the connection is in the pool and simply pass the handler we'd like to swap on. ``` ActiveRecord::Base.connected_to(role: :reading) do Dog.read_something_from_dog ModelInPrimary.do_something_from_model_in_primary end ```
* | | Merge pull request #34110 from ↵Eileen M. Uchitelle2018-10-103-0/+33
|\ \ \ | | | | | | | | | | | | | | | | albertoalmagro/enum-raises-on-invalid-definition-values Enum raises on invalid definition values
| * | | Privatize ENUM_CONFLICT_MESSAGE constantAlberto Almagro2018-10-101-0/+1
| | | |
| * | | Raise on invalid definition valuesAlberto Almagro2018-10-103-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When defining a Hash enum it can be easy to use [] instead of {}. This commit checks that only valid definition values are provided, those can be a Hash, an array of Symbols or an array of Strings. Otherwise it raises an ArgumentError. Fixes #33961
* | | | Merge pull request #34137 from gmcgibbon/db_migrate_status_multi_dbEileen M. Uchitelle2018-10-103-20/+71
|\ \ \ \ | | | | | | | | | | Add multi-db support to rails db:migrate:status