1. 16 2月, 2019 15 次提交
  2. 15 2月, 2019 16 次提交
  3. 14 2月, 2019 9 次提交
    • E
      Improve errors and handling of hashes for database configurations · 06f94343
      eileencodes 提交于
      In chat Sam Saffron asked how to use the setter now that configurations
      is no longer a hash and you need to do AR::Base.configurations["test"]=.
      
      Technically you can do `ActiveRecord::Base.configurations = { the hash
      }` but I realized the old way throws an error and is unintuitive.
      
      To aid in the transition from hashes to objects this PR makes a few
      changes:
      
      1) Re-adds a deprecated hash setter `[]=` that will add a new hash
      to the configurations list OR replace an existing hash if that
      environment is already present. This won't be supported in future Rails
      versions but a good error is important.
      
      2) Changed to throw deprecation warnings on the methods we decided to support
      for hash conversion and raise on the methods we don't support.
      
      3) Refactored the setter/getter hash deprecation warnings messages and
      rewrote them.
      
      Getters message:
      
      ```
      DEPRECATION WARNING: `ActiveRecord::Base.configurations` no longer
      returns a hash. Methods that act on the hash like `values` are
      deprecated and will be removed in Rails 6.1. Use the `configs_for`
      method to collect and iterate over the database configurations.
      ```
      
      Setter message:
      
      ```
      DEPRECATION WARNING: Setting `ActiveRecord::Base.configurations` with
      `[]=` is deprecated. Use `ActiveRecord::Base.configurations=` directly
      to set the configurations instead.
      ```
      
      4) Rewrote the legacy configurations test file to test all the public
      methods in the DatabaseConfigurations class.
      06f94343
    • E
      Fix the `config_for` to always return a NonSymbolAccessDeprecatedHash: · 4f7231da
      Edouard CHIN 提交于
      - If you have hashes inside array, the hashes were getting initialized
        as regular HWIA wereas we want them to be
        NonSymbolAccessDeprecatedHash in order to trigger a deprecation
        warning when keys are accessed with string.
      
        This patch fixes that by overwriting the `[]=` to to the same
        as what HWIA does (with the difference that we don't call
        `convert_key` to not trigger a deprecation when setting value).
      
        I also took the liberty to extract `hash.nested_under_indifferent_access`,
        into a separate method to allow subclasses to return whatever
        they want.
        Inheriting HWIA is not common, but I think it's useful for cases
        like this one where we want to preprocess reading and writing values
        in the hash (for deprecation purposes or other reasons).
      4f7231da
    • X
      Register new autoloading in AS CHANGELOG [ci skip] · e53430fa
      Xavier Noria 提交于
      There is too much to say about it for a CHANGELOG entry, and linking to
      the original PR could mislead if there are later changes as already
      happened with the gem dependency, so just a one-liner.
      
      For final we'll up to date documentation.
      e53430fa
    • X
      Merge pull request #35261 from rails/zeitwerk-as-dependency · a20b00db
      Xavier Noria 提交于
      Let Zeitwerk be a dependency of Active Support
      a20b00db
    • R
      Merge pull request #35266 from ricardotk002/use-dir-children · 0117589a
      Ryuta Kamizono 提交于
      Use Dir#children and Dir#each_child in ActiveSupport::Cache::FileStore
      0117589a
    • Y
      Add test for `csp_meta_tag` · 3f186e30
      yuuji.yaginuma 提交于
      3f186e30
    • R
      Use Dir#children and Dir#each_child instead of excluding "." and ".." · df29b664
      Ricardo Díaz 提交于
      Both methods were introduced in Ruby 2.5 and fit this use case very
      nicely: listing a directory's entries excluding the "." and ".." nodes.
      
      The private method #exclude_from was removed as it no longer serves
      its original purpose.
      df29b664
    • R
      Merge pull request #35238 from gwincr11/cg-active-job-queue-time · ac68550a
      Rafael Mendonça França 提交于
      Adding enque time tracking and logging
      ac68550a
    • C
      Adding enque time tracking and logging · 31021c78
      Cory Gwin @gwincr11 提交于
      Motivation:
        - Currently we have 2 seperate monkey patches in place for tracking
        enqueded time for 2 seperate workers. It seems that activejob could be
        a source of truth for how long an item has been enqued so that we can
        easily use it for consistent monitoring across workers/apps to ensure
        that jobs are running at an acceptable speed.
      
      Changes:
        - Add an enqueded at attribute and serilization tooling.
        - Add a method to get how long a job has been enqueded for.
        - Add a logging item to show how long a job was enqued prior to the
        perform method firing.
      31021c78