Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Feb 27, 2013
  1. @steveklabnik
Commits on Feb 23, 2013
  1. @senny

    Sqlite preserves primary keys when copying/altering tables.

    senny authored
    Backport #2312.
    Fixes #9367.
    
    I also added a test-case to make sure that renaming or removing
    a column preserves the primary key.
Commits on Feb 7, 2013
  1. @dylanahsmith
Commits on Jan 15, 2013
  1. @carlosantoniodasilva
  2. @carlosantoniodasilva

    Revert "Merge pull request #7983 from georgebrock/bug7950-squashed"

    carlosantoniodasilva authored
    This reverts commit 88a296d, reversing
    changes made to 666a7e3.
    
    Conflicts:
    	activerecord/CHANGELOG.md
    
    Reason: this has been resulting in some hard to track bugs and is
    introducing a possible breackage in a stable version.
Commits on Jan 7, 2013
  1. @rafaelfranca

    connection_parameters is an Array and will never have

    rafaelfranca authored
    prepared_statements as value
Commits on Jan 6, 2013
  1. @trisweb @rafaelfranca

    Fix error when assigning NaN to an integer column

    trisweb authored rafaelfranca committed
    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
    
    Backport of #8781
    
    Conflicts:
    	activerecord/CHANGELOG.md
    	activerecord/test/cases/column_test.rb
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.
    
    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 = Post.new
        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 = Post.new
        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 = @collection.new
    
    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
    behaviour.
    
    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 = Post.new
        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 = @collection.new
        @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 = Post.new
    
        # 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.
    non-integers)
Commits on Dec 19, 2012
  1. @senny

    Backport #8522, Keep index names when using with sqlite3

    senny authored senny committed
    Conflicts:
    
    	activerecord/CHANGELOG.md
    	activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
    	activerecord/test/cases/migration/rename_column_test.rb
Commits on Dec 5, 2012
  1. @rafaelfranca

    Merge pull request #8417 from kennyj/fix_8414

    rafaelfranca authored
    Fix #8414. Performance problem with postgresql adapter primary_key function.
    Conflicts:
    	activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Commits on Nov 30, 2012
  1. @tenderlove @rafaelfranca

    Merge pull request #6397 from kennyj/fix_translate_exception

    tenderlove authored rafaelfranca committed
    Fix a problem of translate_exception method in a Japanese (non English) environment.
Commits on Nov 28, 2012
  1. @jeremy @carlosantoniodasilva
Commits on Nov 26, 2012
  1. @tenderlove @carlosantoniodasilva

    schema cache already has the columns as a hash, so use that

    tenderlove authored carlosantoniodasilva committed
    Commits
    
      978ec98 and
      5167665
    
    changed database statements to use the schema_cache methods, added on
    master in
    
      c99e34e and
      dc973e7
    
    But apparently the methods weren't added to schema_cache, resulting in
    the failure described in #8322 for 3-2-stable.
    
    Fixes #8322.
    
    Conflicts:
    	activerecord/lib/active_record/connection_adapters/schema_cache.rb
  2. @tenderlove
  3. @tenderlove
Commits on Nov 20, 2012
  1. @rafaelfranca

    Merge pull request #8276 from pwnall/pgsql_text_limits

    rafaelfranca authored
    Postgresql doesn't accepts limits on text columns
    Conflicts:
    	activerecord/CHANGELOG.md
    	activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Commits on Nov 19, 2012
  1. @carlosantoniodasilva

    Be a bit less conservative with mysql in adapter

    carlosantoniodasilva authored
    This will allow the new mysql 2.9.0 to be used, fixing our test issues.
Commits on Nov 10, 2012
  1. @tenderlove @georgebrock

    use bind values for join columns

    tenderlove authored georgebrock committed
    This is a backport of 4bc2ae0.
    It fixes bug #7950.
    
    Conflicts:
    
    	activerecord/lib/active_record/relation/calculations.rb
    	activerecord/lib/active_record/relation/finder_methods.rb
Commits on Oct 30, 2012
  1. @rafaelfranca

    Fix typo :bomb: [ci skip]

    rafaelfranca authored
  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. @graceliu @rafaelfranca

    fixed support for DATABASE_URL for rake db tasks

    graceliu authored rafaelfranca committed
    Backport for #7521
    
    - added tests to confirm establish_connection uses DATABASE_URL and
      Rails.env correctly even when no arguments are passed in.
    - updated rake db tasks to support DATABASE_URL, and added tests to
      confirm correct behavior for these rake tasks.  (Removed
      establish_connection call from some tasks since in those cases
      the :environment task already made sure the function would be called)
    - updated Resolver so that when it resolves the database url, it
      removes hash values with empty strings from the config spec (e.g.
      to support connection to postgresql when no username is specified).
    - updated ResolverTest to use current_adapter? to check the type of
      the current adapter.
  2. @rafaelfranca

    Merge pull request #8057 from frodsan/fix_sqlite_mutate_arg

    rafaelfranca authored
    SQLite3Adapter#type_cast should not mutate arguments
    Conflicts:
    	activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
  3. @rafaelfranca

    Make Active Record tests pass in isolation

    rafaelfranca authored
    Also remove the feature detecting for Ruby 1.9
  4. @rafaelfranca

    Merge pull request #7593 from veader/patch-1

    rafaelfranca authored
    Decode attributes pulled from URI.parse
    Conflicts:
    	activerecord/CHANGELOG.md
    	activerecord/lib/active_record/connection_adapters/connection_specification.rb
Commits on Oct 15, 2012
  1. @tenderlove
Commits on Oct 14, 2012
  1. @arturopie

    7914 Using a better way to get the defaults from db.

    arturopie authored
    Changes:
    
    * According to postgreSQL documentation:
    (http://www.postgresql.org/docs/8.2/static/catalog-pg-attrdef.html)
    we should not be using 'adsrc' field because this field is unaware of
    outside changes that could affect the way that default values are
    represented. Thus, I changed the queries to use
    "pg_get_expr(adbin, adrelid)" instead of the historical "adsrc" field.
    
    * Remove parsing of character type default values for 8.1 formatting since
    Rails doesn't support postgreSQL 8.1 anymore.
    
    * Remove misleading comment unrelated to code.
  2. @arturopie

    #7914 get default value when type uses schema name

    arturopie authored
    PostgreSQL adapter properly parses default values when using multiple
    schemas and domains.
    
    When using domains across schemas, PostgresSQL prefixes the type of the
    default value with the name of the schema where that type (or domain) is.
    
    For example, this query:
    ```
    SELECT a.attname, d.adsrc
    FROM pg_attribute a LEFT JOIN pg_attrdef d
    ON a.attrelid = d.adrelid AND a.attnum = d.adnum
    WHERE a.attrelid = "defaults"'::regclass
    AND a.attnum > 0 AND NOT a.attisdropped
    ORDER BY a.attnum;
    ```
    
    could return something like "'<default_value>'::pg_catalog.text" or
    "(''<default_value>'::pg_catalog.text)::text" for the text columns with
    defaults.
    
    I modified the regexp used to parse this value so that it ignores
    anything between ':: and \b(?:character varying|bpchar|text), and it
    allows to have optional parens like in the above second example.
Commits on Oct 6, 2012
  1. @rafaelfranca

    Merge pull request #7850 from senny/5920_postgres_adapter_table_with_…

    rafaelfranca authored
    …capital_letters
    
    postgres, quote table names when fetching the primary key (#5920)
    Conflicts:
    	activerecord/CHANGELOG.md
    	activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Commits on Sep 24, 2012
  1. @jrochkind

    ConnectionPool accepts spec key 'checkout_timeout'

    jrochkind authored
    Backport of #6441 cb6f839 . Old 'wait_timeout' is still supported,
    but conflicts with mysql2 using that spec key for different thing.
    'checkout_timeout' can now be used taking precedence for ConnectionPool
    over 'wait_timeout'.
Commits on Sep 20, 2012
  1. @rafaelfranca

    Revert "backport fair connection pool 02b2335 to 3-2-stable"

    rafaelfranca authored
    This reverts commit 0693e07.
    
    Revert "Cache columns metadata to avoid extra while testing"
    
    This reverts commit a82f1e3.
    
    Reason: This is causing failures in the postgresql build.
    See http://travis-ci.org/#!/rails/rails/builds/2485584
    
    Related with #7675
Commits on Sep 17, 2012
  1. @jrochkind
  2. @rafaelfranca

    Backport explain fixes.

    rafaelfranca authored
    * Mark as SCHEMA some schema database queries. #7648
    * Don't explain queries except normal CRUD sql. #7657
    
    Closes #6458
    Closes #7544
Commits on Sep 13, 2012
  1. Backport PostgreSQL auto-reconnect test coverage

    Steve Jorgensen authored
    6d5f4de
    Simulated & actual (manual/skipped) PostgreSQL auto-reconnection tests.
    
    4b1bca0
    Stop being silly with formatting of method aliasing.
    
    c381d5c
    Fix just-plain-wrongness of psql auto-reconnect test.
    
    1e17a9d
    Fix only-once stub logic.
    
    f16c2043826ec1991cf94fe17cb671507b7a7f51
    Changelog for PostgreSQL auto-reconnect test coverage backport.
Commits on Sep 9, 2012
  1. @rafaelfranca

    Merge pull request #7582 from tchandy/fix_type_cast_code

    rafaelfranca authored
    type_cast_code should always convert values to integer calling #to_i
  2. @tchandy

    ConnectionAdapters::Column.type_cast_code should always convert value…

    tchandy authored
    …s to integer calling #to_i
Something went wrong with that request. Please try again.