Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Feb 14, 2013
  1. @warnickr

    9253: Before writing a numeric attribute value, ActiveRecord does an …

    warnickr authored
    conversion of boolean types (true => 1 and false => 0). If the numeric value
    being assigned is a BigDecimal, then ActiveRecord compares a BigDecimal to
    true and false. This is known to be very slow in Ruby 1.9.3.
Commits on Jan 23, 2013
  1. @slbug
Commits on Jan 6, 2013
  1. @trisweb

    Fix error when assigning NaN to an integer column

    trisweb authored
    Also covers any non-castable case by returning nil, which
    is in-line with the intention of the former implementation,
    but covers the odd cases which respond to to_i but raise
    an error when it's called, such as NaN, Infinity and -Infinity.
    Fixes #8757
Commits on Jan 3, 2013
  1. Fix undefined method `to_i' introduced since 3.2.8

    Jason Stirk authored
    This commit fixes a bug introduced in 96a13fc which breaks behaviour of
    integer fields.
    In 3.2.8, setting the value of an integer field to a non-integer (eg.
    Array, Hash, etc.) would default to 1 (true) :
        # 3.2.8
        p =
        p.category_id = [ 1, 2 ]
        p.category_id # => 1
        p.category_id = { 3 => 4 }
        p.category_id # => 1
    In 3.2.9 and above, this will raise a NoMethodError :
        # 3.2.9
        p =
        p.category_id = [ 1, 2 ]
        NoMethodError: undefined method `to_i' for [1, 2]:Array
    Whilst at first blush this appear to be sensible, it combines in bad
    ways with scoping.
    For example, it is common to use scopes to control access to data :
        @collection = Posts.where(:category_id => [ 1, 2 ])
        @new_post =
    In 3.2.8, this would work as expected, creating a new Post object
    (albeit with @new_post.category_id = 1). However, in 3.2.9 this will
    cause the NoMethodError to be raised as above.
    It is difficult to avoid triggering this error without descoping before
    calling .new, breaking any apps running on 3.2.8 that rely on this
    This patch deviates from 3.2.8 in that it does not retain the somewhat
    spurious behaviour of setting the attribute to 1. Instead, it explicitly
    sets these invalid values to nil :
        p =
        p.category_id = [ 1, 2 ]
        p.category_id # => nil
    This also fixes the situation where a scope using an array will
    "pollute" any newly instantiated records.
        @new_post =
        @new_post.category_id # => nil
    Finally, 3.2.8 exhibited a behaviour where setting an object to an
    integer field caused it to be coerced to "1". This has not been
    retained, as it is spurious and surprising in the same way that setting
    Arrays and Heshes was :
        c = Category.find(6)
        p =
        # 3.2.8
        p.category_id = c
        p.category_id # => 1
        # This patch
        p.category_id = c
        p.category_id # => nil
    This commit includes explicit test cases that expose the original issue
    with calling new on a scope that uses an Array. As this is a common
    situation, an explicit test case is the best way to prevent regressions
    in the future.
    It also updates and separates existing tests to be explicit about the
    situation that is being tested (eg. AR objects vs. other objects vs.
Commits on Dec 16, 2012
  1. @le0pard
Commits on Dec 11, 2012
  1. @pixeltrix

    Deprecate obsolete Time to DateTime fallback methods

    pixeltrix authored
    The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time
    methods were added to handle the limitations of Ruby's native Time
    implementation. Those limitations no longer apply so we are deprecating
    them in 4.0 and they will be removed in 4.1.
Commits on Oct 30, 2012
  1. @gazay
  2. @rafaelfranca

    Fix bug when Column is trying to type cast boolean values to integer.

    rafaelfranca authored
    This can occur if the user is using :integer columns to store boolean
    values. Now we are handling the boolean values but it still raises if
    the value can't type cast to integer and is not a boolean. See #7509.
    Fixes #8067.
Commits on Oct 29, 2012
  1. @nikitug

    Provide a call stack for deprecation warnings where needed.

    nikitug authored
    It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
Commits on Oct 19, 2012
  1. @jonleighton

    The default value of a text/blob in mysql strict mode should be nil

    jonleighton authored
    In non-strict mode it is '', but if someone is in strict mode then we
    should honour the strict semantics.
    Also, this removes the need for a completely horrible hack in dirty.rb.
    Closes #7780
Commits on Sep 28, 2012
  1. @jonleighton

    Support for partial inserts.

    jonleighton authored
    When inserting new records, only the fields which have been changed
    from the defaults will actually be included in the INSERT statement.
    The other fields will be populated by the database.
    This is more efficient, and also means that it will be safe to
    remove database columns without getting subsequent errors in running
    app processes (so long as the code in those processes doesn't
    contain any references to the removed column).
Commits on Sep 13, 2012
  1. @tchandy
Commits on Sep 6, 2012
  1. @guedes

    ActiveRecord support to PostgreSQL 9.2 JSON type

    guedes authored
    This implements the support to encode/decode JSON
    data to/from database and creating columns of type
    JSON using a native type [1] supported by PostgreSQL
    from version 9.2.
Commits on Sep 5, 2012
  1. @adzap

    Fix for time type columns with invalid time

    adzap authored
    The string_to_dummy_time method was blindly parsing the dummy time string
    with Date._parse which returns a hash for the date part regardless
    of whether the time part is an invalid time string.
Commits on Aug 15, 2012
  1. @aripollak

    Fix occasional microsecond conversion inaccuracy

    aripollak authored
    ActiveRecord::ConnectionAdapters::Column#microseconds did an unnecessary
    conversion to from Rational to float when calculating the integer number
    of microseconds. Some terminating decimal numbers in base10 are
    repeating decimal numbers in base2 (the format of float), and
    occasionally this causes a rounding error.
    Patch & explanation originally from Logan Bowers.
Commits on Aug 2, 2012
  1. @fxn
Commits on May 16, 2012
  1. @tenderlove

    Merge pull request #6192 from danmcclain/add_inet_and_cidr_types_to_p…

    tenderlove authored
    Add support for macaddr, inet, and cidr types to PostgreSQL adapter
Commits on May 7, 2012
  1. @danmcclain
Commits on May 5, 2012
  1. @flexoid
Commits on Apr 30, 2012
  1. Don't type cast values that don't respond to to_i to 1

    James Sanders & Jason Noble authored
Commits on Mar 30, 2012
  1. @carlosantoniodasilva
Commits on Feb 11, 2012
  1. @tenderlove
Commits on Feb 9, 2012
Commits on Feb 6, 2012
  1. @tenderlove
Commits on Jan 12, 2012
  1. @spastorino
Commits on Dec 20, 2011
  1. @tenderlove
Commits on Dec 19, 2011
  1. @lest
Commits on Jun 20, 2011
  1. @dazuma

    Add missing require 'set'

    dazuma authored
Commits on May 17, 2011
  1. Year 0 should fall to nil only if month and day are also 0

    Kirill Radzikhovskyy authored
Commits on Feb 4, 2011
  1. @tenderlove
Commits on Feb 1, 2011
  1. @tenderlove
Something went wrong with that request. Please try again.