1. 23 1月, 2018 2 次提交
  2. 22 1月, 2018 9 次提交
  3. 21 1月, 2018 1 次提交
  4. 20 1月, 2018 5 次提交
  5. 19 1月, 2018 19 次提交
  6. 18 1月, 2018 4 次提交
    • M
      Revert "Merge pull request #31434 from olivierlacan/boot-feedback" · c0461434
      Matthew Draper 提交于
      This reverts commit edc54fd2, reversing
      changes made to a5922f13.
      
      As discussed, this is not an appropriate place to make assumptions about
      ARGV, or to write to stdout: config/boot.rb is a library and is required
      by other applictions, with which we have no right to interfere.
      c0461434
    • E
      Merge pull request #31727 from... · 6e74e1d1
      Eileen M. Uchitelle 提交于
      Merge pull request #31727 from eileencodes/refactor-migration-classes-to-allow-for-migrations_paths-on-conn
      
      Refactor migration to move migrations paths to connection
      6e74e1d1
    • E
      Refactor migration to move migrations paths to connection · a2827ec9
      eileencodes 提交于
      Rails has some support for multiple databases but it can be hard to
      handle migrations with those. The easiest way to implement multiple
      databases is to contain migrations into their own folder ("db/migrate"
      for the primary db and "db/seconddb_migrate" for the second db). Without
      this you would need to write code that allowed you to switch connections
      in migrations. I can tell you from experience that is not a fun way to
      implement multiple databases.
      
      This refactoring is a pre-requisite for implementing other features
      related to parallel testing and improved handling for multiple
      databases.
      
      The refactoring here moves the class methods from the `Migrator` class
      into it's own new class `MigrationContext`. The goal was to move the
      `migrations_paths` method off of the `Migrator` class and onto the
      connection. This allows users to do the following in their
      `database.yml`:
      
      ```
      development:
        adapter: mysql2
        username: root
        password:
      
      development_seconddb:
        adapter: mysql2
        username: root
        password:
        migrations_paths: "db/second_db_migrate"
      ```
      
      Migrations for the `seconddb` can now be store in the
      `db/second_db_migrate` directory. Migrations for the primary database
      are stored in `db/migrate`".
      
      The refactoring here drastically reduces the internal API for migrations
      since we don't need to pass `migrations_paths` around to every single
      method. Additionally this change does not require any Rails applications
      to make changes unless they want to use the new public API. All of the
      class methods from the `Migrator` class were `nodoc`'d except for the
      `migrations_paths` and `migrations_path` getter/setters respectively.
      a2827ec9
    • K
      Enable autocorrect for `Lint/EndAlignment` cop · 5ac6ec54
      Koichi ITO 提交于
      ### Summary
      
      This PR changes .rubocop.yml.
      
      Regarding the code using `if ... else ... end`, I think the coding style
      that Rails expects is as follows.
      
      ```ruby
      var = if cond
        a
      else
        b
      end
      ```
      
      However, the current .rubocop.yml setting does not offense for the
      following code.
      
      ```ruby
      var = if cond
              a
            else
              b
            end
      ```
      
      I think that the above code expects offense to be warned.
      Moreover, the layout by autocorrect is unnatural.
      
      ```ruby
      var = if cond
        a
            else
              b
            end
      ```
      
      This PR adds a setting to .rubocop.yml to make an offense warning and
      autocorrect as expected by the coding style.
      And this change also fixes `case ... when ... end` together.
      
      Also this PR itself is an example that arranges the layout using
      `rubocop -a`.
      
      ### Other Information
      
      Autocorrect of `Lint/EndAlignment` cop is `false` by default.
      https://github.com/bbatsov/rubocop/blob/v0.51.0/config/default.yml#L1443
      
      This PR changes this value to `true`.
      
      Also this PR has changed it together as it is necessary to enable
      `Layout/ElseAlignment` cop to make this behavior.
      5ac6ec54