1. 23 9月, 2016 1 次提交
    • P
      Return true if attribute is not changed for update_attribute · 730e99af
      Prathamesh Sonpatki 提交于
      - If the attribute is not changed, then update_attribute does not run
        SQL query, this effectively means that no change was made to the
        attribute.
      - This change was made in https://github.com/rails/rails/commit/0fcd4cf5
        to avoid a SQL call.
      - But the change resulted into `nil` being returned when there was no
        change in the attribute value.
      - This commit corrects the behavior to return true if there is no change
        in attribute value. This is same as previous behavior of Rails 4.2
        plus benefit of no additional SQL call.
      - Fixes #26593.
      730e99af
  2. 20 9月, 2016 1 次提交
    • R
      Always store errors details information with symbols · d406014b
      Rafael Mendonça França 提交于
      When the association is autosaved we were storing the details with
      string keys. This was creating inconsistency with other details that are
      added using the `Errors#add` method. It was also inconsistent with the
      `Errors#messages` storage.
      
      To fix this inconsistency we are always storing with symbols. This will
      cause a small breaking change because in those cases the details could
      be accessed as strings keys but now it can not.
      
      The reason that we chose to do this breaking change is because `#details`
      should be considered a low level object like `#messages` is.
      
      Fix #26499.
      
      [Rafael Mendonça França + Marcus Vieira]
      d406014b
  3. 17 9月, 2016 1 次提交
  4. 16 9月, 2016 2 次提交
  5. 14 9月, 2016 5 次提交
  6. 12 9月, 2016 2 次提交
    • Y
      Add tests for ActiveRecord::Enum#enum when suffix specified · 6009107c
      Yosuke Kabuto 提交于
      Make name of attribute medium instead of normal
      6009107c
    • Y
      remove duplicated fixture set names · 1b128f89
      yuuji.yaginuma 提交于
      If using namespaced fixtures, get following Ruby warning.
      
      ```
      activerecord/lib/active_record/fixtures.rb:922: warning: method redefined; discarding old admin_foos
      activerecord/lib/active_record/fixtures.rb:922: warning: previous definition of admin_foos was here
      ```
      
      This is happening because of the multiple set the same path when setting the
      fixture name. Fix to remove the duplicate path.
      1b128f89
  7. 11 9月, 2016 5 次提交
  8. 10 9月, 2016 2 次提交
  9. 08 9月, 2016 1 次提交
    • D
      activerecord/mysql2: Avoid setting @connection to nil, just close it · 01adc456
      Dylan Thacker-Smith 提交于
      By doing `@connection = nil` that means that we need nil checks before it
      is used anywhere, but we weren't doing those checks.  Instead, we get a
      NoMethodError after using a connection after it fails to reconnect.
      
      Neither of the other adapters set @connection to nil, just the mysql2
      adapter. By just closing it, we avoid the need to check if we have a
      connection object and it will produce an appropriate exception when used.
      01adc456
  10. 07 9月, 2016 2 次提交
  11. 06 9月, 2016 3 次提交
  12. 04 9月, 2016 1 次提交
  13. 03 9月, 2016 4 次提交
  14. 02 9月, 2016 2 次提交
  15. 01 9月, 2016 4 次提交
    • S
      Include user defined attributes in inspect · 8ab9daf2
      Sean Griffin 提交于
      The fact that this only includes column names is an oversight.
      8ab9daf2
    • S
      Remove deprecated handling of PG Points · b347156b
      Sean Griffin 提交于
      There are some minor changes to the point type as I had forgotten that
      this will affect the behavior of `t.point` in migrations and the schema
      dumper so we need to handle those as well.
      
      I'll say this again so I can convince myself to come up with a better
      structure... TYPES SHOULD NOT CARE ABOUT SCHEMA DUMPING AND WE NEED TO
      BETTER SEPARATE THESE.
      b347156b
    • S
      Revert "Extract `PredicateBuilder::CaseSensitiveHandler`" · 84efde74
      Sean Griffin 提交于
      This reverts commit 3a1f6fe7.
      
      This commit takes the code in a direction that I am looking to avoid.
      The predicate builder should be purely concerned with AST construction
      as it matters to methods like `where`. Things like case sensitivity
      should continue to be handled elsewhere.
      84efde74
    • S
      Attempt to maintain encoding for arrays of strings with PG · 7ba3a48d
      Sean Griffin 提交于
      I still think that this is something that should be handled in the pg
      gem, but it's not going to end up happening there so we'll do it here
      instead. Once we bump to pg 0.19 we can pass the encoding to the
      `encode` method instead.
      
      This issue occurs because C has no concept of encoding (or strings,
      really). The bytes that we pass here when sending the value to the
      database will always be interpreted as whatever encoding the connection
      is currently configured to use. That means that roundtripping to the
      database will lose no information
      
      However, after assigning we round trip through our type system without
      hitting the database. The only way that we can do the "correct" thin
      here would be to actually give a reference to the connection to the
      array type and have it check the current value of the connection's
      encoding -- which I'm strongly opposed to. We could also pass in the
      encoding when it's constructed, but since that can change independently
      of the type I'm not a huge fan of that either.
      
      This feels like a reasonable middle ground, where if we have an array of
      strings we simply use the encoding of the string we're given.
      
      Fixes #26326.
      7ba3a48d
  16. 31 8月, 2016 3 次提交
    • S
      Override `respond_to_missing?` instead of `respond_to?` when possible · 03d3f036
      Sean Griffin 提交于
      This was almost every case where we are overriding `respond_to?` in a
      way that mirrors a parallel implementation of `method_missing`. There is
      one remaining case in Active Model that should probably do the same
      thing, but had a sufficiently strange implementation that I want to
      investigate it separately.
      
      Fixes #26333.
      03d3f036
    • S
      Ensure that inverse associations are set before running callbacks · caa178c1
      Sean Griffin 提交于
      If a parent association was accessed in an `after_find` or
      `after_initialize` callback, it would always end up loading the
      association, and then immediately overwriting the association we just
      loaded. If this occurred in a way that the parent's `current_scope` was
      set to eager load the child, this would result in an infinite loop and
      eventually overflow the stack.
      
      For records that are created with `.new`, we have a mechanism to
      perform an action before the callbacks are run. I've introduced the same
      code path for records created with `instantiate`, and updated all code
      which sets inverse instances on newly loaded associations to use this
      block instead.
      
      Fixes #26320.
      caa178c1
    • S
      Refactor remove duplication. · 547698e8
      Santosh Wadghule 提交于
      547698e8
  17. 28 8月, 2016 1 次提交