Skip to content
Commits on Sep 14, 2015
  1. @tenderlove
  2. @claudiob

    Merge pull request #21619 from kamipo/fix_doc_of_text_limit

    Fix doc of limit option for a text column [ci skip]
    claudiob committed Sep 14, 2015
  3. @kamipo

    Fix doc of limit option for a text column [ci skip]

    Follow up #21591.
    
    The document of limit option for a text column is incorrect.
    
    MySQL: the limit is byte length, not character length
    Pg, Sqlite3: variable unlimited length
    kamipo committed Sep 14, 2015
  4. @claudiob

    Merge pull request #21617 from lunks/patch-1

    Fix HSTS default expire in ActionDispatch::SSL docs.
    claudiob committed Sep 13, 2015
  5. @lunks
Commits on Sep 13, 2015
  1. @fxn

    Merge pull request #21611 from amitsuroliya/improve_docs

    fix typo intance -> instance in ActionView [ci skip]
    fxn committed Sep 13, 2015
  2. @amitsuroliya

    fix typo intance -> instance in ActionView [ci skip]

    `intance` should be `instance`
    amitsuroliya committed Sep 13, 2015
  3. @rafaelfranca

    Merge pull request #21591 from kamipo/text_and_blob_limit_is_byte_length

    TEXT and BLOB limit is byte length, not character length.
    rafaelfranca committed Sep 13, 2015
  4. @rafaelfranca

    Merge pull request #21568 from amitsuroliya/mysql_version_update

    Updated MySQL documentation link to MySQL latest version 5.7 everywhe…
    rafaelfranca committed Sep 13, 2015
Commits on Sep 12, 2015
  1. @rafaelfranca

    Merge pull request #21604 from amitsuroliya/remove_wrong_docs

    Improving `in_time_zone` docs [ci skip]
    rafaelfranca committed Sep 12, 2015
  2. @amitsuroliya

    Improving `in_time_zone` docs [ci skip]

    `DateTime.utc` is not a valid method. It gives `NoMethodError: undefined method `utc` for DateTime:Class`. As we know that we can calculate `utc` time from `Time` Class, but we can’t calculate `utc` time from `DateTime` Class.
    amitsuroliya committed Sep 13, 2015
  3. @rafaelfranca

    Merge pull request #21602 from Eric-Guo/master

    Ruby 2.2.3 in windows need nokogiri 1.6.7.rc3
    rafaelfranca committed Sep 12, 2015
  4. @senny

    Merge pull request #21603 from Eric-Guo/dev_edge_common

    dev and edge have some common, so factor it out.
    senny committed Sep 12, 2015
  5. @Eric-Guo
  6. @Eric-Guo

    Ruby 2.2.3 in windows need nokogiri 1.6.7.rc3 as it's the only versio…

    …n having correct pre-compiled so
    Eric-Guo committed Sep 12, 2015
  7. @fxn

    Merge pull request #21596 from JuanitoFatas/perf/strip-heredoc

    Improve String#strip_heredoc
    fxn committed Sep 12, 2015
  8. @JuanitoFatas

    Improve String#strip_heredoc

    Saves about 6 MB, about 40% faster.
    
    **strip_heredoc.rb**
    
    ```ruby
    require "active_support/core_ext/object/try"
    require "get_process_mem"
    
    class String
      def strip_heredoc
        indent = scan(/^[ \t]*(?=\S)/).min.try(:size) || 0
        gsub(/^[ \t]{#{indent}}/, '')
      end
    end
    
    if ENV["MEASURE_MEMORY"] == "yes"
      mem = GetProcessMem.new
      GC.start
      GC.disable
      10000.times do
        <<-MSG.strip_heredoc
          xhr and xml_http_request methods are deprecated in favor of
          `get :index, xhr: true` and `post :create, xhr: true`
        MSG
      end
      before = mem.mb
    
      after = mem.mb
      GC.enable
      puts "Before: #{before} MiB"
      puts "After: #{after} MiB"
      puts "Diff: #{after - before} MiB"
    end
    ```
    
    **patched_strip_heredoc.rb**
    
    ```ruby
    require "active_support/core_ext/object/try"
    require "get_process_mem"
    
    class String
      def patched_strip_heredoc
        gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, "".freeze)
      end
    end
    
    if ENV["MEASURE_MEMORY"] == "yes"
      mem = GetProcessMem.new
      GC.start
      GC.disable
      10000.times do
        <<-MSG.patched_strip_heredoc
          xhr and xml_http_request methods are deprecated in favor of
          `get :index, xhr: true` and `post :create, xhr: true`
        MSG
      end
      before = mem.mb
    
      after = mem.mb
      GC.enable
      puts "Before: #{before} MiB"
      puts "After: #{after} MiB"
      puts "Diff: #{after - before} MiB"
    end
    ```
    
    **Before**
    
    ```
    $ MEASURE_MEMORY=yes ruby strip_heredoc.rb
    Before: 44.73828125 MiB
    After: 44.7734375 MiB
    Diff: 0.03515625 MiB
    ```
    
    **After**
    
    ```
    $ MEASURE_MEMORY=yes ruby patched_strip_heredoc.rb
    Before: 37.9765625 MiB
    After: 38.015625 MiB
    Diff: 0.0390625 MiB
    ```
    
    `44.7734375 -  38.015625 = 6.75`
    
    => **Saves about 6.75 MiB**
    
    **benchmark.rb**
    
    ```ruby
    require "benchmark/ips"
    require_relative "./strip_heredoc"
    require_relative "./patched_strip_heredoc"
    
    def original
      <<-MSG.strip_heredoc
        xhr and xml_http_request methods are deprecated in favor of
        `get :index, xhr: true` and `post :create, xhr: true`
      MSG
    end
    
    def patched
      <<-MSG.patched_strip_heredoc
        xhr and xml_http_request methods are deprecated in favor of
        `get :index, xhr: true` and `post :create, xhr: true`
      MSG
    end
    
    Benchmark.ips do |x|
      x.report("original") { original }
      x.report(" patched") { patched  }
      x.compare!
    end
    ```
    
    ```
    $ ruby -v benchmark.rb
    ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
    Calculating -------------------------------------
                original     5.652k i/100ms
                 patched     6.477k i/100ms
    -------------------------------------------------
                original     54.076k (± 5.7%) i/s -    271.296k
                 patched     74.557k (± 6.2%) i/s -    375.666k
    
    Comparison:
                 patched:    74557.0 i/s
                original:    54076.4 i/s - 1.38x slower
    ```
    
    => **About 38% faster**
    
    1. Clone rails project `git clone git@github.com:rails/rails.git`
    2. Apply this patch to
    `activesupport/lib/active_support/core_ext/string/strip.rb`
    3. `cd activesupport`
    4. run `rake`
    5. And tests passed:
    
    ```
    ➜ activesupport $ rake
    /Users/Juan/.rubies/ruby-2.2.2/bin/ruby -w -I"lib:test"
    "/Users/Juan/.rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_test_loader.rb"
     "test/**/*_test.rb"
    
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ........................................................................
    ......................................................................S.
    SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
    
    Finished in 15.343004s, 214.2344 runs/s, 24902.4898 assertions/s.
    
    3287 runs, 382079 assertions, 0 failures, 0 errors, 48 skips
    
    You have skipped tests. Run with --verbose for details.
    ```
    JuanitoFatas committed Sep 12, 2015
Commits on Sep 11, 2015
  1. @kamipo
  2. @eileencodes

    Merge pull request #21585 from lachlanjc/patch-1

    Remove RHTML reference in Action Controller docs
    eileencodes committed Sep 10, 2015
  3. @lachlanjc
Commits on Sep 10, 2015
  1. @claudiob

    Merge pull request #21584 from claudiob/remove-hawd-doc

    Remove wrong doc line about AC::Parameters
    claudiob committed Sep 10, 2015
  2. @claudiob

    Remove wrong doc line about AC::Parameters

    AC::Parameters does not inherit from HashWithIndifferentAccess
    since #20868 by @sikachu
    claudiob committed Sep 10, 2015
  3. @senny

    Merge pull request #21575 from y-yagi/description_of_passing_block_to…

    …_add_source
    
    add description of passing a block to `add_source` [ci skip]
    senny committed Sep 10, 2015
  4. @y-yagi

    add description of passing a block to `add_source` [ci skip]

    block support added in 8cc01e0
    y-yagi committed Sep 10, 2015
  5. @amatsuda

    Explicitly require AR/attribute where using it

    autoloading this could possibly cause some weird race condition
    when calling an AR::Attribute's singleton method on a threaded server.
    amatsuda committed Sep 10, 2015
  6. @amitsuroliya

    Updated MySQL documentation link to MySQL latest version 5.7 everywhe…

    …re [ci skip]
    
    Bumps from `5.6` to `5.7`
    amitsuroliya committed May 20, 2015
  7. @zzak

    Merge pull request #21567 from y-yagi/fix_inspect_doc

    fix wrong method used in the TimeWithZone#inspect method docs [ci skip]
    zzak committed Sep 9, 2015
  8. @y-yagi
Commits on Sep 9, 2015
  1. @eileencodes

    Merge pull request #21333 from imtayadeway/ar-querying-docs

    Improve the AR querying docs
    eileencodes committed Sep 9, 2015
  2. @imtayadeway

    [ci skip] Update MySQL docs reference to latest

    Bumps to 5.7
    imtayadeway committed Aug 22, 2015
  3. @imtayadeway

    [ci skip] Improve readability in AR querying guide

    * rewords a few awkwardly worded sentences
    * adds some punctuation
    * adds a few missing words
    imtayadeway committed Aug 22, 2015
  4. @senny

    remove dead code.

    The last call site of `last_version` was removed with:
    
    838e183
    senny committed Sep 9, 2015
  5. @eileencodes

    Update documentation to reflect Rack::Session::Abstract changes

    `Rack::Session::Abstract::ID` is now deprecated and
    `Rack::Session::Abstract::Persisted` should be used instead.
    eileencodes committed Sep 9, 2015
  6. @eileencodes

    Handle Content-Types that are not :json, :xml, or :url_encoded_form

    In c546a2b this was changed to mimic how the browser behaves in a real
    situation but left out types that were registered.
    
    When this was changed it didn't take `text/plain` or `text/html` content
    types into account. This is a problem if you're manipulating the
    `Content-Type` headers in your controller tests, and expect a certain
    result.
    
    The reason I changed this to use `to_sym` is because if the
    `Content-Type` is not registered then the symbol will not exist. If it's
    one of the special types we handle that specifically (:json, :xml, or
    :url_encoded_form). If it's any registered type we handle it by setting
    the `path_parameters` and then the `request_parameters`. If the `to_sym`
    returns nil an error will be thrown.
    
    If the controller test sets a `Content-Type` on the request that `Content-Type`
    should remain in the header and pass along the filename.
    
    For example:
    If a test sets a content type on a post
    ```
    @request.headers['CONTENT_TYPE'] = 'text/plain'
    post :create, params: { name: 'foo.txt' }
    ```
    
    Then `foo.txt` should be in the `request_parameters` and params related
    to the path should be in the `path_parameters` and the `Content-Type`
    header should match the one set in the `@request`. When c546a2b was
    committed `text/plain` and `text/html` types were throwing a "Unknown
    Content-Type" error which is misleading and incorrect.
    
    Note: this does not affect how this is handled in the browser, just how
    the controller tests handle setting `Content-Type`.
    eileencodes committed Sep 8, 2015
Something went wrong with that request. Please try again.