1. 13 10月, 2018 2 次提交
    • E
      Fix issue where duration where always rounded up to a second: · c85e3f65
      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
      c85e3f65
    • D
      Improve model attribute accessor method names for backtraces · 99c87ad2
      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.
      99c87ad2
  2. 12 10月, 2018 7 次提交
  3. 11 10月, 2018 8 次提交
    • G
      Include test gems in CI · d888bec6
      Gannon McGibbon 提交于
      d888bec6
    • G
      Add test retries for railties · 2e53c2b1
      Gannon McGibbon 提交于
      2e53c2b1
    • K
      Merge pull request #34189 from orhantoy/fix-link-to-concurrent-ruby-docs · 81bbcea6
      Kasper Timm Hansen 提交于
      [ci skip] Fix link to Concurrent::ThreadPoolExecutor docs
      81bbcea6
    • O
      [ci skip] Fix link to Concurrent::ThreadPoolExecutor docs · 6865f73b
      Orhan Toy 提交于
      6865f73b
    • R
      Merge pull request #34188 from yskkin/remove_comment · 6a278c6e
      Ryuta Kamizono 提交于
      Remove invalid magic comment [ci skip]
      6a278c6e
    • Y
      Remove invalid magic comment [ci skip] · e6a0c34b
      Yoshiyuki Kinjo 提交于
      e6a0c34b
    • E
      Merge pull request #34052 from eileencodes/connection-switching · fb8bee4a
      Eileen M. Uchitelle 提交于
      Part 4: Multi db improvements, Basic API for connection switching
      fb8bee4a
    • E
      Basic API for connection switching · 31021a8c
      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
      ```
      31021a8c
  4. 10 10月, 2018 20 次提交
  5. 09 10月, 2018 3 次提交
    • R
      Generate delegation methods to named scope in the definition time · 136b738c
      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.
      136b738c
    • Y
      Use `--skip-webpack-install` by default · 9195cdb7
      yuuji.yaginuma 提交于
      To remove extra `--no-skip-javascript` tests.
      9195cdb7
    • Y
      Avoid `webpacker:install` if unnecessary · 7c846d9c
      yuuji.yaginuma 提交于
      `webpacker:install` also includes execution of yarn, it takes time to execute,
      so avoid unnecessary tests.
      7c846d9c