1. 18 7月, 2015 5 次提交
  2. 17 7月, 2015 8 次提交
  3. 16 7月, 2015 8 次提交
    • R
      Merge pull request #20892 from zoltankiss/make-params-method-returns-consistent · 094571b4
      Rafael Mendonça França 提交于
      Standardize `ActionController::Parameters#to_unsafe_h` return value
      094571b4
    • Z
      Standardize `ActionController::Parameters#to_unsafe_h` return value · ea6e7ffd
      Zoltan Kiss 提交于
      `ActionController::Parameters#to_h` returns a hash, so lets have
      `ActionController::Parameters#to_unsafe_h` return a hash instead of
      an `ActiveSupport::HashWithIndifferentAccess` for consistency.
      ea6e7ffd
    • R
      Merge pull request #20888 from sikachu/remove-support-for-force-reload · 424b379c
      Rafael Mendonça França 提交于
      Deprecate force association reload by passing true
      424b379c
    • R
      Merge pull request #20868 from sikachu/params-not-inherited-from-hwia · 4f21269c
      Rafael Mendonça França 提交于
      Make AC::Parameters not inherited from Hash
      4f21269c
    • P
      Deprecate force association reload by passing true · 6eae366d
      Prem Sichanugrist 提交于
      This is to simplify the association API, as you can call `reload` on the
      association proxy or the parent object to get the same result.
      
      For collection association, you can call `#reload` on association proxy
      to force a reload:
      
          @user.posts.reload   # Instead of @user.posts(true)
      
      For singular association, you can call `#reload` on the parent object to
      clear its association cache then call the association method:
      
          @user.reload.profile   # Instead of @user.profile(true)
      
      Passing a truthy argument to force association to reload will be removed
      in Rails 5.1.
      6eae366d
    • R
      Merge pull request #20887 from tgxworld/ar_callbacks · 64c12644
      Rafael Mendonça França 提交于
      Revert "Revert "Reduce allocations when running AR callbacks.""
      64c12644
    • P
      Update documentation on `AC::Parameters` · 84b861f1
      Prem Sichanugrist 提交于
      84b861f1
    • G
      Revert "Revert "Reduce allocations when running AR callbacks."" · beb07fbf
      Guo Xiang Tan 提交于
      This reverts commit bdc1d329.
      
      Before:
      Calculating -------------------------------------
                              22.000  i/100ms
      -------------------------------------------------
                              229.700  (± 0.4%) i/s -      1.166k
      Total Allocated Object: 9939
      
      After:
      Calculating -------------------------------------
                              24.000  i/100ms
      -------------------------------------------------
                              246.443  (± 0.8%) i/s -      1.248k
      Total Allocated Object: 7939
      
      ```
      begin
        require 'bundler/inline'
      rescue LoadError => e
        $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
        raise e
      end
      
      gemfile(true) do
        source 'https://rubygems.org'
        # gem 'rails', github: 'rails/rails', ref: 'bdc1d329'
        gem 'rails', github: 'rails/rails', ref: 'd2876141'
        gem 'arel', github: 'rails/arel'
        gem 'sqlite3'
        gem 'benchmark-ips'
      end
      
      require 'active_record'
      require 'benchmark/ips'
      
      ActiveRecord::Base.establish_connection('sqlite3::memory:')
      
      ActiveRecord::Migration.verbose = false
      
      ActiveRecord::Schema.define do
        create_table :users, force: true do |t|
          t.string :name, :email
          t.boolean :admin
          t.timestamps null: false
        end
      end
      
      class User < ActiveRecord::Base
        default_scope { where(admin: true) }
      end
      
      admin = true
      
      1000.times do
        attributes = {
          name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
          email: "foobar@email.com",
          admin: admin
        }
      
        User.create!(attributes)
      
        admin = !admin
      end
      
      GC.disable
      
      Benchmark.ips(5, 3) do |x|
        x.report { User.all.to_a }
      end
      
      key =
        if RUBY_VERSION < '2.2'
          :total_allocated_object
        else
          :total_allocated_objects
        end
      
      before = GC.stat[key]
      User.all.to_a
      after = GC.stat[key]
      puts "Total Allocated Object: #{after - before}"
      ```
      beb07fbf
  4. 15 7月, 2015 7 次提交
  5. 14 7月, 2015 11 次提交
  6. 12 7月, 2015 1 次提交