1. 17 6月, 2019 3 次提交
  2. 16 6月, 2019 3 次提交
  3. 15 6月, 2019 15 次提交
  4. 14 6月, 2019 13 次提交
    • E
      Move SchemaMigration to migration_context · 7cc27d74
      eileencodes 提交于
      This PR moves the `schema_migration` to `migration_context` so that we
      can access the `schema_migration` per connection.
      
      This does not change behavior of the SchemaMigration if you are using
      one database. This also does not change behavior of any public APIs.
      `Migrator` is private as is `MigrationContext` so we can change these as
      needed.
      
      We now need to pass a `schema_migration` to `Migrator` so that we can
      run migrations on the right connection outside the context of a rake
      task.
      
      The bugs this fixes were discovered while debugging the issues around
      the SchemaCache on initialization with multiple database. It was clear
      that `get_all_versions` wouldn't work without these changes outside the
      context of a rake task (because in the rake task we establish a
      connection and change AR::Base.connection to the db we're running on).
      
      Because the `SchemaCache` relies on the `SchemaMigration` information we
      need to make sure we store it per-connection rather than on
      ActiveRecord::Base.
      
      [Eileen M. Uchitelle & Aaron Patterson]
      7cc27d74
    • R
      Merge pull request #36484 from albertoalmagro/alberto/reverse-column-is-reversible · c2847716
      Ryuta Kamizono 提交于
      [ci skip] Update docs as `remove_column` can be reversed
      c2847716
    • R
      Fix rubocop violations · c0af72bf
      Ryuta Kamizono 提交于
      c0af72bf
    • A
      [ci skip] Update docs as `remove_column` can be reversed · 88de3179
      Alberto Almagro 提交于
      As `remove_column` can be reversed when a type is provided this example
      was not accurate anymore.
      88de3179
    • R
      Merge pull request #36478 from kamipo/allocation_on_demand_in_transaction · 2c3332cc
      Ryuta Kamizono 提交于
      Allocation on demand in transactions
      2c3332cc
    • R
      Allocation on demand in transactions · 05c718a1
      Ryuta Kamizono 提交于
      Currently 1,000 transactions creates 10,000 objects regardless whether
      it is necessary or not.
      
      This makes allocation on demand in transactions, now 1,000 transactions
      creates required 5,000 objects only by default.
      
      ```ruby
      ObjectSpace::AllocationTracer.setup(%i{path line type})
      
      pp ObjectSpace::AllocationTracer.trace {
        1_000.times { User.create }
      }.select { |k, _| k[0].end_with?("transaction.rb") }
      ```
      
      Before (95d038f0):
      
      ```
      {["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        209,
        :T_HASH]=>[1000, 0, 715, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        210,
        :T_OBJECT]=>[1000, 0, 715, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        210,
        :T_HASH]=>[1000, 0, 715, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        80,
        :T_OBJECT]=>[1000, 0, 715, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        8,
        :T_ARRAY]=>[1000, 0, 715, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        81,
        :T_ARRAY]=>[1000, 0, 715, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        289,
        :T_STRING]=>[1000, 0, 714, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        116,
        :T_ARRAY]=>[1000, 0, 714, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        120,
        :T_ARRAY]=>[1000, 0, 714, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        121,
        :T_HASH]=>[1000, 0, 714, 0, 1, 0]}
      ```
      
      After (this change):
      
      ```
      {["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        213,
        :T_HASH]=>[1000, 0, 739, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        214,
        :T_OBJECT]=>[1000, 0, 739, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        214,
        :T_HASH]=>[1000, 0, 739, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        81,
        :T_OBJECT]=>[1000, 0, 739, 0, 1, 0],
       ["~/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb",
        304,
        :T_STRING]=>[1000, 0, 738, 0, 1, 0]}
      ```
      05c718a1
    • R
      Merge pull request #36477 from albertoalmagro/alberto/button-to-default-path · 95d038f0
      Rafael França 提交于
      [ci skip] Use default path in button_to documentation
      95d038f0
    • G
      Merge pull request #36437 from sudara/fix_programmatic_clicks_with_data_remote · c9e52d02
      Gannon McGibbon 提交于
      Fix programmatic clicks with data-remote
      c9e52d02
    • A
      [ci skip] Use default path in button_to documentation · 4f4fd0a6
      Alberto Almagro 提交于
      This is really a nit pick, but as this is the framework's documentation
      I think it should follow standards as many times as possible to avoid
      confusion in new users.
      
      If we were using `resources :articles` in routes. which is what scaffold
      adds, the generated helper would be `new_article_path` instead of
      `new_articles_path`.
      4f4fd0a6
    • J
      Make ActiveRecord `ConnectionPool.connections` thread-safe. (#36473) · e2d11970
      jeffdoering 提交于
      * Make ActiveRecord `ConnectionPool.connections` thread-safe.
      
      ConnectionPool documentation is clear on the need to synchronize
      access to @connections but also states that public methods do not
      require synchronization. Existing code exposed @connections
      directly via attr_reader. The fix uses synchronize() to lock
      @connections then returns a copy to the caller using Array.dup().
      
      Includes comments on the connections method that thread-safe access
      to the connections array does not imply thread-safety of accessing
      methods on the actual connections.
      
      Adds a test-case that modifies the pool using a supported method
      in one thread  while a second thread accesses pool.connections.
      The test fails without this patch.
      
      Fixes #36465.
      
      * Update activerecord/test/cases/connection_pool_test.rb
      
      [jeffdoering + Rafael Mendonça França]
      e2d11970
    • S
      Ensure non-mouse/programmatic clicks work with data-remote · ab4ed8c7
      Sudara 提交于
      ab4ed8c7
    • R
      Merge pull request #36466 from wbnns/update-missing-create-action-screenshot · 136f730f
      Rafael França 提交于
      images/getting_started: Update screenshot for missing action
      136f730f
    • A
      Merge pull request #36388 from joelhawksley/actionview-component · 3683a828
      Aaron Patterson 提交于
      Introduce ActionView::Component
      3683a828
  5. 13 6月, 2019 6 次提交