1. 29 2月, 2016 2 次提交
    • R
      Fix tests failure with `prepared_statements: false` · 8d7554e9
      Ryuta Kamizono 提交于
      Some tests does not work for unprepared statements.
      Add `if ActiveRecord::Base.connection.prepared_statements` and fix a
      regex for fix tests failure with `prepared_statements: false`.
      8d7554e9
    • R
      Fix `NoMethodError: undefined method `preparable'` · e4ad3b26
      Ryuta Kamizono 提交于
      The error occurs with `prepared_statements: false`:
      
      ```
      $ ARCONN=postgresql bundle exec ruby -w -Itest test/cases/associations_test.rb
      Using postgresql
      Run options: --seed 27753
      
      ...E....................................
      
      Finished in 0.713115s, 56.0919 runs/s, 91.1494 assertions/s.
      
        1) Error:
      AssociationsTest#test_force_reload_is_uncached:
      NoMethodError: undefined method `preparable' for #<Arel::Visitors::PostgreSQL:0x007f8699702570>
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `block in select_all'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:83:in `cache_sql'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `select_all'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/querying.rb:39:in `find_by_sql'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:699:in `exec_queries'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/association_relation.rb:32:in `exec_queries'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:580:in `load'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:260:in `records'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:256:in `to_a'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_association.rb:458:in `get_records'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_association.rb:473:in `find_target'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_association.rb:412:in `load_target'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_proxy.rb:45:in `load_target'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_proxy.rb:983:in `records'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:39:in `each'
          test/cases/associations_test.rb:116:in `block (2 levels) in test_force_reload_is_uncached'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:32:in `cache'
          /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
          test/cases/associations_test.rb:115:in `block in test_force_reload_is_uncached'
          /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/deprecation/reporting.rb:36:in `silence'
          /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/deprecation/instance_delegator.rb:19:in `silence'
          test/cases/associations_test.rb:114:in `test_force_reload_is_uncached'
      ```
      e4ad3b26
  2. 28 2月, 2016 1 次提交
  3. 25 2月, 2016 4 次提交
  4. 24 2月, 2016 7 次提交
    • E
      Prep release for Rails 5 beta3 · 826420b5
      eileencodes 提交于
      826420b5
    • R
      Ensure `drop_table` even if tests failure or interrupted · 95441c7b
      Ryuta Kamizono 提交于
      I was encountered remaining `:binary_testings` table by tests failure.
      When remaining `:binary_testings` table, never reach `drop_table` due to
      `create_table` in the test always fails.
      95441c7b
    • E
      Remove changelog entry for reverted commit · 5a064bec
      eileencodes 提交于
      I had to revert changes made for this CHANGELOG entry so this is no
      longer valid. The change for this entry was removed in 2c02bc0a.
      5a064bec
    • R
      `drop_table :test_text_limits` as well · 5d146f6e
      Ryuta Kamizono 提交于
      Follow up to 3b017856.
      5d146f6e
    • Y
      3e302bc6
    • E
      Revert changes to validations from PR #18612 · 2c02bc0a
      eileencodes 提交于
      In order to fix issue #17621 we added a check to validations that
      determined if a record should be validated. Based on the existing tests
      and behavior we wanted we determined the best way to do that was by
      checking if `!record.peristed? || record.changed? || record.marked_for_destruction?`
      
      This change didn't make it into a release until now. When #23790 was
      opened we realized that `valid?` and `invalid?` were broken and did not
      work on persisted records because of the `!record.persisted?`.
      
      While there is still a bug that #17621 brought up, this change was too
      drastic and should not be a RC blocker. I will work on fixing this so
      that we don't break `valid?` but also aren't validating parent records
      through child records if that parent record is validate false. This
      change removes the code changes to validate and the corresponding tests.
      It adds tests for two of the bugs found since Rails 5 beta2 release.
      
      Fixes #17621
      2c02bc0a
    • A
      reestablish previous connection after creating all databases · 79887593
      Aaron Patterson 提交于
      creating all databases mutates the connection pool.  This patch restores
      the connection pool to the connection spec established before creating
      all databases.  Fixes #23279
      79887593
  5. 23 2月, 2016 5 次提交
  6. 22 2月, 2016 2 次提交
  7. 21 2月, 2016 2 次提交
  8. 20 2月, 2016 4 次提交
    • E
      Always validate record if validating a virtual attribute · 6f15b276
      eileencodes 提交于
      Fixes #23645
      
      When you're using an `attr_accessor` for a record instead of an
      attribute in the database there's no way for the record to know if it
      has `changed?` unless you tell it `attribute_will_change!("attribute")`.
      
      The change made in 27aa4dda updated validations to check if a record was
      `changed?` or `marked_for_destruction?` or not `persisted?`. It did not
      take into account virtual attributes that do not affect the model's
      dirty status.
      
      The only way to fix this is to always validate the record if the
      attribute does not belong to the set of attributes the record expects
      (in `record.attributes`) because virtual attributes will not be in that
      hash.
      
      I think we should consider deprecating this particular behavior in the
      future and requiring that the user mark the record dirty by noting that
      the virtual attribute will change. Unfortunately this isn't easy because
      we have no way of knowing that you did the "right thing" in your
      application by marking it dirty and will get the deprecation warning
      even if you are doing the correct thing.
      
      For now this restores expected behavior when using a virtual attribute
      by always validating the record, as well as adds tests for this case.
      
      I was going to add the `!record.attributes.include?(attribute)` to the
      `should_validate?` method but `uniqueness` cannot validate a virtual
      attribute with nothing to hold on to the attribute. Because of this
      `should_validate?` was about to become a very messy method so I decided
      to split them up so we can handle it specifically for each case.
      6f15b276
    • L
      fix typo · b2d1de26
      Lobsiinvok 提交于
      b2d1de26
    • A
      eliminate warnings about multiple primary keys on habtm join tables · 2df891dc
      Aaron Patterson 提交于
      habtm join tables commonly have two id columns and it's OK to make those
      two id columns a primary key.  This commit eliminates the warnings for
      join tables that have this setup.
      
        ManageIQ/manageiq#6713
      2df891dc
    • K
      Add methods to array delegation from `Relation` · 95c24e9f
      Kevin Dougherty 提交于
      Delegation of some `Array` methods was removed in commit 9d79334a. That
      change did add explicit delegation of a few methods that `Array` has but
      which aren't on `Enumerable`.  However, a few non-mutation methods were
      omitted.  This adds `Array` delegation of `#in_groups`, `#in_groups_of`,
      `#shuffle` and `#split`.  This allows things like
      `MyThing.all.in_groups_of(3) { ... }` to continue working as they did
      before commit 9d79334a.
      95c24e9f
  9. 19 2月, 2016 1 次提交
  10. 18 2月, 2016 5 次提交
  11. 17 2月, 2016 5 次提交
    • R
      Remove needless `case_insensitive_comparison` in mysql2 adapter · 4da96789
      Ryuta Kamizono 提交于
      Simply it is sufficient to override `can_perform_case_insensitive_comparison_for?`.
      4da96789
    • P
      Show proper error message when a non-relation object is passed to AR::Relation#or · e254665a
      Prathamesh Sonpatki 提交于
      - Previously it used to show error message
          <"undefined method `limit_value' for {:title=>\"Rails\"}:Hash">
      
      - Now it shows following error message.
      
          >> Post.where.not(name: 'DHH').or(name: 'Tenderlove')
          ArgumentError: You have passed Hash object to #or. Pass an ActiveRecord::Relation object instead.
      
      - Fixes #23714.
      e254665a
    • A
      Fix semantics of test names for finish option in batches_test · b13a00ed
      Akshay 提交于
      - The change was added in #23099
      b13a00ed
    • P
      Fixed `where` for polymorphic associations when passed an array containing different types. · 359adaed
      Philippe Huibonhoa 提交于
      When passing in an array of different types of objects to `where`, it would only take into account the class of the first object in the array.
      
          PriceEstimate.where(estimate_of: [Treasure.find(1), Car.find(2)])
      	# => SELECT "price_estimates".* FROM "price_estimates"
               WHERE ("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" IN (1, 2))
      
      This is fixed to properly look for any records matching both type and id:
      
          PriceEstimate.where(estimate_of: [Treasure.find(1), Car.find(2)])
          # => SELECT "price_estimates".* FROM "price_estimates"
               WHERE (("price_estimates"."estimate_of_type" = 'Treasure' AND "price_estimates"."estimate_of_id" = 1)
               OR ("price_estimates"."estimate_of_type" = 'Car' AND "price_estimates"."estimate_of_id" = 2))
      359adaed
    • D
      Test parent local_stored_attributes isn't modified · 72eee06b
      David Genord II 提交于
      Saw the `merge!` and had to prove to myself that the parent model's local_stored_attributes was not being changed when stored_attributes is called on a child model. Proved to be working as expected but this test is probably still useful to keep around.
      72eee06b
  12. 16 2月, 2016 2 次提交
    • V
      Add missing CHANGELOG for regression fix in #18155 which fixes #13387 · 8d3912ac
      Vipul A M 提交于
      [ci skip]
      8d3912ac
    • G
      Let t.foreign_key use the same `to_table` twice · aedde2a3
      George Millo 提交于
      Previously if you used `t.foreign_key` twice within the same
      `create_table` block using the same `to_table`, all statements except
      the final one would fail silently. For example, the following code:
      
          def change
            create_table :flights do |t|
              t.integer :from_id, index: true, null: false
              t.integer :to_id,   index: true, null: false
      
              t.foreign_key :airports, column: :from_id
              t.foreign_key :airports, column: :to_id
            end
          end
      
      Would only create one foreign key, on the column `from_id`.
      
      This commit allows multiple foreign keys to the same table to be created
      within one `create_table` block.
      aedde2a3