1. 07 4月, 2015 2 次提交
  2. 06 4月, 2015 2 次提交
  3. 04 4月, 2015 1 次提交
    • E
      Don't invoke sql_runtime if logger is not set to info · 191facc8
      eileencodes 提交于
      `sql_runtime` was getting invoked even when the logger was set to fatal.
      This ensures that does not happen by checking that the logger is set to
      info level before logging the view runtime.
      
      This reduces the number of times `sql_runtime` is called for integration
      tests with a fatal logger from 6 to 2.
      191facc8
  4. 03 4月, 2015 1 次提交
  5. 02 4月, 2015 2 次提交
    • B
      Freeze static arguments for gsub · 58d75fd8
      brainopia 提交于
      58d75fd8
    • B
      Prefer string patterns for gsub · cdac52e1
      brainopia 提交于
      https://github.com/ruby/ruby/pull/579 - there is a new optimization
      since ruby 2.2
      
      Previously regexp patterns were faster (since a string was converted to
      regexp underneath anyway). But now string patterns are faster and
      better reflect the purpose.
      
        Benchmark.ips do |bm|
          bm.report('regexp') { 'this is ::a random string'.gsub(/::/, '/') }
          bm.report('string') { 'this is ::a random string'.gsub('::', '/') }
          bm.compare!
        end
        # string: 753724.4 i/s
        # regexp: 501443.1 i/s - 1.50x slower
      cdac52e1
  6. 01 4月, 2015 2 次提交
  7. 31 3月, 2015 2 次提交
    • K
      use Model.reset_column_information to clear table cache connection wide. · bf6a33fd
      Kuldeep Aggarwal 提交于
          `widgets` table is being created in `primary_keys_test.rb` for PostgreSQLAdapter, MysqlAdapter, Mysql2Adapter
          and it makes test to fail earlier.
      
          Before:
            `bundle exec rake mysql2:test`
      
          ```
          Finished in 127.287669s, 35.5258 runs/s, 97.8885 assertions/s.
      
            1) Error:
          PersistenceTest::SaveTest#test_save_touch_false:
          ActiveModel::UnknownAttributeError: unknown attribute 'name' for #<Class:0x0000000a7d6ef0>.
              /home/kd/projects/kd-rails/activerecord/lib/active_record/attribute_assignment.rb:36:in `rescue in _assign_attribute'
              /home/kd/projects/kd-rails/activerecord/lib/active_record/attribute_assignment.rb:34:in `_assign_attribute'
              /home/kd/projects/kd-rails/activemodel/lib/active_model/attribute_assignment.rb:40:in `block in _assign_attributes'
              /home/kd/projects/kd-rails/activemodel/lib/active_model/attribute_assignment.rb:39:in `each'
              /home/kd/projects/kd-rails/activemodel/lib/active_model/attribute_assignment.rb:39:in `_assign_attributes'
              /home/kd/projects/kd-rails/activerecord/lib/active_record/attribute_assignment.rb:26:in `_assign_attributes'
              /home/kd/projects/kd-rails/activemodel/lib/active_model/attribute_assignment.rb:33:in `assign_attributes'
              /home/kd/projects/kd-rails/activerecord/lib/active_record/core.rb:293:in `initialize'
              /home/kd/projects/kd-rails/activerecord/lib/active_record/inheritance.rb:61:in `new'
              /home/kd/projects/kd-rails/activerecord/lib/active_record/inheritance.rb:61:in `new'
              /home/kd/projects/kd-rails/activerecord/lib/active_record/persistence.rb:50:in `create!'
              /home/kd/projects/kd-rails/activerecord/test/cases/persistence_test.rb:913:in `test_save_touch_false'
      
          4522 runs, 12460 assertions, 0 failures, 1 errors, 4 skips
          ```
      
          After:
            `bundle exec rake mysql2:test`
      
          ```
             Finished in 135.785086s, 33.3026 runs/s, 91.7774 assertions/s.
      
             4522 runs, 12462 assertions, 0 failures, 0 errors, 4 skips
          ```
      bf6a33fd
    • A
      86881673
  8. 30 3月, 2015 2 次提交
    • S
      Clarify the role of `ActiveRecord::Core.encode_with` · 01421d5b
      Sean Griffin 提交于
      Fixes #19568
      01421d5b
    • S
      Reduce memory usage when loading types in PG · 445c12f7
      Sean Griffin 提交于
      We were never clearing the `PG::Result` object used to query the types
      when the connection is first established. This would lead to a
      potentially large amount of memory being retained for the life of the
      connection.
      
      Investigating this issue also revealed several low hanging fruit on the
      performance of these methods, and the number of allocations has been
      reduced by ~90%.
      
      Fixes #19578
      445c12f7
  9. 29 3月, 2015 1 次提交
  10. 27 3月, 2015 1 次提交
  11. 26 3月, 2015 1 次提交
    • J
      Add `config.active_record.warn_on_records_fetched_greater_than` option · 4d6fbe29
      Jason Nochlin 提交于
      When set to an integer, a warning will be logged whenever a result set
      larger than the specified size is returned by a query. Fixes #16463
      
      The warning is outputed a module which is prepended in an initializer,
      so there will be no performance impact if
      `config.active_record.warn_on_records_fetched_greater_than` is not set.
      4d6fbe29
  12. 25 3月, 2015 5 次提交
  13. 24 3月, 2015 2 次提交
    • C
      DRY up STI subclass logic · 7be08818
      Cody Cutrer 提交于
      the newer method used for discriminating new records did not
      use the older and more robust method used for instantiating
      existing records, but did have a better post-check to ensure
      the sublass was in the hierarchy. so move the descendants check
      to find_sti_class, and then simply call find_sti_class from
      subclass_from_attributes
      7be08818
    • Y
      [ci skip] Remove unacceptable method name · dbc7acd8
      yui-knk 提交于
      dbc7acd8
  14. 23 3月, 2015 6 次提交
  15. 22 3月, 2015 3 次提交
  16. 21 3月, 2015 1 次提交
    • J
      Fix documentation for find_or_create_by · 4364211b
      Joe Van Dyk 提交于
      The code in the comment fails on concurrent inserts if done inside a transaction. 
      
      The fix is to force a savepoint to run so that if the database raises an unique violation exception. Otherwise, you'll get errors like:
      
      ```
         (0.3ms)  BEGIN
        Cart Load (0.5ms)  SELECT  "carts".* FROM "carts"  WHERE "carts"."uuid" = '12345' LIMIT 1
      
      # Another process inserts a cart with uuid of '12345' right now
      
        SQL (4371.7ms)  INSERT INTO "carts" ("created_at", "updated_at", "uuid") VALUES ('2015-03-21 01:05:07.833231', '2015-03-21 01:05:07.833231', '12345') RETURNING "id"  [["created_at", Sat, 21 Mar 2015 01:05:07 PDT -07:00], ["updated_at", Sat, 21 Mar 2015 01:05:07 PDT -07:00], ["uuid", "12345"]]
      PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "carts_uuid_idx1"
      DETAIL:  Key (uuid)=(12345) already exists.
      : INSERT INTO "carts" ("created_at", "updated_at", "uuid") VALUES ('2015-03-21 01:05:07.833231', '2015-03-21 01:05:07.833231', '12345') RETURNING "id"
      
      # Retrying the find
      
        Cart Load (0.8ms)  SELECT  "carts".* FROM "carts"  WHERE "carts"."uuid" = '12345' LIMIT 1
      PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
      : SELECT  "carts".* FROM "carts"  WHERE "carts"."uuid" = '12345' LIMIT 1
         (0.1ms)  ROLLBACK
      ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
      : SELECT  "carts".* FROM "carts"  WHERE "carts"."uuid" = '12345' LIMIT 1
      ```
      4364211b
  17. 20 3月, 2015 4 次提交
  18. 19 3月, 2015 2 次提交