- 13 10月, 2018 2 次提交
-
-
由 Edouard CHIN 提交于
- 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
-
由 Dylan Thacker-Smith 提交于
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.
-
- 12 10月, 2018 7 次提交
-
-
由 Francesco Rodríguez 提交于
-
由 Jeremy Daer 提交于
Deprecate Unicode#downcase/upcase/swapcase.
-
由 yuuji.yaginuma 提交于
-
由 Francesco Rodríguez 提交于
-
由 Francesco Rodríguez 提交于
Use String methods directly instead.
-
由 Eileen Uchitelle 提交于
Check that options passed to the to_json are passed to all objects that respond to as_json.
-
由 Rafael França 提交于
Add test retries for railties
-
- 11 10月, 2018 8 次提交
-
-
由 Gannon McGibbon 提交于
-
由 Gannon McGibbon 提交于
-
由 Kasper Timm Hansen 提交于
[ci skip] Fix link to Concurrent::ThreadPoolExecutor docs
-
由 Orhan Toy 提交于
-
由 Ryuta Kamizono 提交于
Remove invalid magic comment [ci skip]
-
由 Yoshiyuki Kinjo 提交于
-
由 Eileen M. Uchitelle 提交于
Part 4: Multi db improvements, Basic API for connection switching
-
由 Eileen Uchitelle 提交于
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 ```
-
- 10 10月, 2018 20 次提交
-
-
由 Eileen M. Uchitelle 提交于
Enum raises on invalid definition values
-
由 Eileen M. Uchitelle 提交于
Add multi-db support to rails db:migrate:status
-
由 Eileen M. Uchitelle 提交于
Follow up #34064
-
由 Eileen M. Uchitelle 提交于
Add allocations to template renderer subscription
-
由 Eileen Uchitelle 提交于
This PR adds the allocations to the instrumentation for template and partial rendering. Before: ``` Rendering posts/new.html.erb within layouts/application Rendered posts/_form.html.erb (9.7ms) Rendered posts/new.html.erb within layouts/application (10.9ms) Completed 200 OK in 902ms (Views: 890.8ms | ActiveRecord: 0.8ms) ``` After: ``` Rendering posts/new.html.erb within layouts/application Rendered posts/_form.html.erb (Duration: 7.1ms | Allocations: 6004) Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654) Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564) ```
-
由 Alberto Almagro 提交于
-
由 Alberto Almagro 提交于
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
-
由 Ryuta Kamizono 提交于
Generate delegation methods to named scope in the definition time
-
由 Ryuta Kamizono 提交于
Fix inconsistent behavior by clearing QueryCache when reloading associations
-
由 Ryuta Kamizono 提交于
Follow up 45be690f. `predicate_builder.build` in `where` requires `load_schema` for `type_for_attribute`.
-
由 Christophe Maximin 提交于
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
-
由 Gannon McGibbon 提交于
-
由 Ryuta Kamizono 提交于
Before: ``` Pet Destroy (0.8ms) DELETE FROM `pets` WHERE `pets`.`pet_id` IN (SELECT `pet_id` FROM (SELECT DISTINCT `pets`.`pet_id` FROM `pets` LEFT OUTER JOIN `toys` ON `toys`.`pet_id` = `pets`.`pet_id` WHERE `toys`.`name` = ?) AS __active_record_temp) [["name", "Bone"]] ``` After: ``` Pet Destroy (1.0ms) DELETE `pets` FROM `pets` LEFT OUTER JOIN `toys` ON `toys`.`pet_id` = `pets`.`pet_id` WHERE `toys`.`name` = ? [["name", "Bone"]] ```
-
由 Eileen M. Uchitelle 提交于
Add `skip-webpack-install` option
-
由 Gannon McGibbon 提交于
Change contributing guide to suggest using safer force push
-
由 Eileen M. Uchitelle 提交于
Move db:migrate:status to DatabaseTasks method
-
由 Gannon McGibbon 提交于
clarify role of unique_id in ActiveSupport::Notifications [ci skip]
-
由 Ryuta Kamizono 提交于
Add docs to ActiveRecord::Persistence#belongs_to_touch_method [ci skip]
-
- 09 10月, 2018 3 次提交
-
-
由 Ryuta Kamizono 提交于
The delegation methods to named scope are defined when `method_missing` is invoked on the relation. Since #29301, the receiver in the named scope is changed to the relation like others (e.g. `default_scope`, etc) for consistency. Most named scopes would be delegated from relation by `method_missing`, since we don't allow scopes to be defined which conflict with instance methods on `Relation` (#31179). But if a named scope is defined with the same name as any method on the `superclass` (e.g. `Kernel.open`), the `method_missing` on the relation is not invoked. To address the issue, make the delegation methods to named scope is generated in the definition time. Fixes #34098.
-
由 yuuji.yaginuma 提交于
To remove extra `--no-skip-javascript` tests.
-
由 yuuji.yaginuma 提交于
`webpacker:install` also includes execution of yarn, it takes time to execute, so avoid unnecessary tests.
-