CHANGELOG

Path: vendor/rails/activerecord/CHANGELOG
Last Update: Wed Mar 27 17:41:12 +0000 2013

*2.3.5 (November 25, 2009)*

  • Minor Bug Fixes and deprecation warnings
  • 1.9 Compatibility
  • Numerous fixes to the nested attributes functionality

*2.3.4 (September 4, 2009)*

  • PostgreSQL: XML datatype support. 1874 [Leonardo Borges]
  • SQLite: deprecate the ‘dbfile’ option in favor of ‘database.’ 2363 [Paul Hinze, Jeremy Kemper]

*2.3.3 (July 12, 2009)*

  • Added :primary_key option to belongs_to associations. 765 [Szymon Nowak, Philip Hallstrom, Noel Rocha]
      # employees.company_name references companies.name
      Employee.belongs_to :company, :primary_key => 'name', :foreign_key => 'company_name'
    
  • Added :touch option to belongs_to associations that will touch the parent record when the current record is saved or destroyed [DHH]
  • Added ActiveRecord::Base#touch to update the updated_at/on attributes (or another specified timestamp) with the current time [DHH]

*2.3.2 [Final] (March 15, 2009)*

  • Added ActiveRecord::Base.find_each and ActiveRecord::Base.find_in_batches for batch processing [DHH/Jamis Buck]
  • Added that ActiveRecord::Base.exists? can be called with no arguments 1817 [Scott Taylor]
  • Add Support for updating deeply nested models from a single form. 1202 [Eloy Duran]
          class Book < ActiveRecord::Base
            has_one :author
            has_many :pages
    
            accepts_nested_attributes_for :author, :pages
          end
    
  • Make after_save callbacks fire only if the record was successfully saved. 1735 [Michael Lovitt]

    Previously the callbacks would fire if a before_save cancelled saving.

  • Support nested transactions using database savepoints. 383 [Jonathan Viney, Hongli Lai]
  • Added dynamic scopes ala dynamic finders 1648 [Yaroslav Markin]
  • Fixed that ActiveRecord::Base#new_record? should return false (not nil) for existing records 1219 [Yaroslav Markin]
  • I18n the word separator for error messages. Introduces the activerecord.errors.format.separator translation key. 1294 [Akira Matsuda]
  • Add :having as a key to find and the relevant associations. [Emilio Tagua]
  • Added default_scope to Base 1381 [Paweł Kondzior]. Example:
      class Person < ActiveRecord::Base
        default_scope :order => 'last_name, first_name'
      end
    
      class Company < ActiveRecord::Base
        has_many :people
      end
    
      Person.all             # => Person.find(:all, :order => 'last_name, first_name')
      Company.find(1).people # => Person.find(:all, :order => 'last_name, first_name', :conditions => { :company_id => 1 })
    

*2.2.1 [RC2] (November 14th, 2008)*

  • Ensure indices don‘t flip order in schema.rb 1266 [Jordi Bunster]
  • Fixed that serialized strings should never be type-casted (i.e. turning "Yes" to a boolean) 857 [Andreas Korth]

*2.2.0 [RC1] (October 24th, 2008)*

  • Skip collection ids reader optimization if using :finder_sql [Jeremy Kemper]
  • Add Model#delete instance method, similar to Model.delete class method. 1086 [Hongli Lai (Phusion)]
  • MySQL: cope with quirky default values for not-null text columns. 1043 [Frederick Cheung]
  • Multiparameter attributes skip time zone conversion for time-only columns [1030 state:resolved] [Geoff Buesing]
  • Base.skip_time_zone_conversion_for_attributes uses class_inheritable_accessor, so that subclasses don‘t overwrite Base [346 state:resolved] [Emilio Tagua]
  • Added find_last_by dynamic finder 762 [Emilio Tagua]
  • Internal API: configurable association options and build_association method for reflections so plugins may extend and override. 985 [Hongli Lai (Phusion)]
  • Changed benchmarks to be reported in milliseconds [David Heinemeier Hansson]
  • Connection pooling. 936 [Nick Sieger]
  • Merge scoped :joins together instead of overwriting them. May expose scoping bugs in your code! 501 [Andrew White]
  • before_save, before_validation and before_destroy callbacks that return false will now ROLLBACK the transaction. Previously this would have been committed before the processing was aborted. 891 [Xavier Noria]
  • Transactional migrations for databases which support them. 834 [divoxx, Adam Wiggins, Tarmo Tänav]
  • Set config.active_record.timestamped_migrations = false to have migrations with numeric prefix instead of UTC timestamp. 446. [Andrew Stone, Nik Wakelin]
  • change_column_default preserves the not-null constraint. 617 [Tarmo Tänav]
  • Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) [334]
  • Add :tokenizer option to validates_length_of to specify how to split up the attribute string. 507. [David Lowenfels] Example :

    # Ensure essay contains at least 100 words. validates_length_of :essay, :minimum => 100, :too_short => "Your essay must be at least %d words."), :tokenizer => lambda {|str| str.scan(/\w+/) }

  • Allow conditions on multiple tables to be specified using hash. [Pratik Naik]. Example:

    User.all :joins => :items, :conditions => { :age => 10, :items => { :color => ‘black’ } } Item.first :conditions => { :items => { :color => ‘red’ } }

  • Always treat integer :limit as byte length. 420 [Tarmo Tänav]
  • Partial updates don‘t update lock_version if nothing changed. 426 [Daniel Morrison]
  • Fix column collision with named_scope and :joins. 46 [Duncan Beevers, Mark Catley]
  • db:migrate:down and :up update schema_migrations. 369 [Michael Raidel, RaceCondition]
  • PostgreSQL: support :conditions => [’:foo::integer’, { :foo => 1 }] without treating the ::integer typecast as a bind variable. [Tarmo Tänav]
  • MySQL: rename_column preserves column defaults. 466 [Diego Algorta]
  • Add :from option to calculations. 397 [Ben Munat]
  • Add :validate option to associations to enable/disable the automatic validation of associated models. Resolves 301. [Jan De Poorter]
  • PostgreSQL: use ‘INSERT … RETURNING id’ for 8.2 and later. [Jeremy Kemper]
  • Added SQL escaping for :limit and :offset in MySQL [Jonathan Wiess]

*2.1.0 (May 31st, 2008)*

  • Add ActiveRecord::Base.sti_name that checks ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. [Rick Olson]
  • Add first/last methods to associations/named_scope. Resolved 226. [Ryan Bates]
  • Added SQL escaping for :limit and :offset 288 [Aaron Bedra, Steven Bristol, Jonathan Wiess]
  • Added first/last methods to associations/named_scope. Resolved 226. [Ryan Bates]
  • Ensure hm:t preloading honours reflection options. Resolves 137. [Frederick Cheung]
  • Added protection against duplicate migration names (Aslak Hellesøy) [112]
  • Base#instantiate_time_object: eliminate check for Time.zone, since we can assume this is set if time_zone_aware_attributes is set to true [Geoff Buesing]
  • Time zone aware attribute methods use Time.zone.parse instead of to_time for String arguments, so that offset information in String is respected. Resolves 105. [Scott Fleckenstein, Geoff Buesing]
  • Added change_table for migrations (Jeff Dean) [71]. Example:
      change_table :videos do |t|
        t.timestamps                          # adds created_at, updated_at
        t.belongs_to :goat                    # adds goat_id integer
        t.string :name, :email, :limit => 20  # adds name and email both with a 20 char limit
        t.remove :name, :email                # removes the name and email columns
      end
    
  • Fixed has_many :through .create with no parameters caused a "can‘t dup NilClass" error (Steven Soroka) [85]
  • Added block-setting of attributes for Base.create like Base.new already has (Adam Meehan) [39]
  • Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [67]
  • Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] [26]
  • Added that the MySQL adapter should map integer to either smallint, int, or bigint depending on the :limit just like PostgreSQL [David Heinemeier Hansson]
  • Change validates_uniqueness_of :case_sensitive option default back to true (from [9160]). Love your database columns, don‘t LOWER them. [Rick Olson]
  • Add support for interleaving migrations by storing which migrations have run in the new schema_migrations table. Closes 11493 [Jordi Bunster]
  • ActiveRecord::Base#sum defaults to 0 if no rows are returned. Closes 11550 [Kamal Fariz Mahyuddin]
  • Ensure that respond_to? considers dynamic finder methods. Closes 11538. [James Mead]
  • Ensure that save on parent object fails for invalid has_one association. Closes 10518. [Pratik Naik]
  • Remove duplicate code from associations. [Pratik Naik]
  • Refactor HasManyThroughAssociation to inherit from HasManyAssociation. Association callbacks and <association>_ids= now work with hm:t. 11516 [Ruy Asan]
  • Ensure HABTM#create and HABTM#build do not load entire association. [Pratik Naik]
  • Improve documentation. [Xavier Noria, Jack Danger Canty, leethal]
  • Tweak ActiveRecord::Base#to_json to include a root value in the returned hash: {"post": {"title": …}} [Rick Olson]

    Post.find(1).to_json # => {"title": …} config.active_record.include_root_in_json = true Post.find(1).to_json # => {"post": {"title": …}}

  • Add efficient include? to AssociationCollection (for has_many/has_many :through/habtm). [stopdropandrew]
  • PostgreSQL: create_ and drop_database support. 9042 [ez, pedz, Nick Sieger]
  • Ensure that validates_uniqueness_of works with with_scope. Closes 9235. [Nik Wakelin, cavalle]
  • Partial updates include only unsaved attributes. Off by default; set YourClass.partial_updates = true to enable. [Jeremy Kemper]
  • Removing unnecessary uses_tzinfo helper from tests, given that TZInfo is now bundled [Geoff Buesing]
  • Fixed that validates_size_of :within works in associations 11295, 10019 [cavalle]
  • Track changes to unsaved attributes. [Jeremy Kemper]
  • Switched to UTC-timebased version numbers for migrations and the schema. This will as good as eliminate the problem of multiple migrations getting the same version assigned in different branches. Also added rake db:migrate:up/down to apply individual migrations that may need to be run when you merge branches 11458 [John Barnette]
  • Fixed that has_many :through would ignore the hash conditions 11447 [Emilio Tagua]
  • Fix issue where the :uniq option of a has_many :through association is ignored when find(:all) is called. Closes 9407 [cavalle]
  • Fix duplicate table alias error when including an association with a has_many :through association on the same join table. Closes 7310 [cavalle]
  • More efficient association preloading code that compacts a through_records array in a central location. Closes 11427 [Jack Danger Canty]
  • Improve documentation. [Ryan Bigg, Jan De Poorter, Cheah Chu Yeow, Xavier Shay, Jack Danger Canty, Emilio Tagua, Xavier Noria, Sunny Ripert]
  • Fixed that ActiveRecord#Base.find_or_create/initialize would not honor attr_protected/accessible when used with a hash 11422 [Emilio Tagua]
  • Added ActiveRecord#Base.all/first/last as aliases for find(:all/:first/:last) 11413 [nkallen, Chris O‘Sullivan]
  • Merge the has_finder gem, renamed as ‘named_scope’. 11404 [nkallen]

    class Article < ActiveRecord::Base

      named_scope :published, :conditions => {:published => true}
      named_scope :popular, :conditions => ...
    

    end

    Article.published.paginate(:page => 1) Article.published.popular.count Article.popular.find(:first) Article.popular.find(:all, :conditions => {…})

    See pivots.pivotallabs.com/users/nick/blog/articles/284-hasfinder-it-s-now-easier-than-ever-to-create-complex-re-usable-sql-queries

  • Add has_one :through support. 4756 [Chris O‘Sullivan]
  • Migrations: create_table supports primary_key_prefix_type. 10314 [student, Chris O‘Sullivan]
  • Added logging for dependency load errors with fixtures 11056 [stuthulhu]
  • Time zone aware attributes use Time#in_time_zone [Geoff Buesing]
  • Fixed that scoped joins would not always be respected 6821 [Theory/Jack Danger Canty]
  • Ensure that ActiveRecord::Calculations disambiguates field names with the table name. 11027 [cavalle]
  • Added add/remove_timestamps to the schema statements for adding the created_at/updated_at columns on existing tables 11129 [jramirez]
  • Added ActiveRecord::Base.find(:last) 11338 [Emilio Tagua]
  • test_native_types expects DateTime.local_offset instead of DateTime.now.offset; fixes test breakage due to dst transition [Geoff Buesing]
  • Add :readonly option to HasManyThrough associations. 11156 [Emilio Tagua]
  • Improve performance on :include/:conditions/:limit queries by selectively joining in the pre-query. 9560 [dasil003]
  • Perf fix: Avoid the use of named block arguments. Closes 11109 [adymo]
  • PostgreSQL: support server versions 7.4 through 8.0 and the ruby-pg driver. 11127 [jdavis]
  • Ensure association preloading doesn‘t break when an association returns nil. #11145 [GMFlash]
  • Make dynamic finders respect the :include on HasManyThrough associations. 10998. [cpytel]
  • Base#instantiate_time_object only uses Time.zone when Base.time_zone_aware_attributes is true; leverages Time#time_with_datetime_fallback for readability [Geoff Buesing]
  • Refactor ConnectionAdapters::Column.new_time: leverage DateTime failover behavior of Time#time_with_datetime_fallback [Geoff Buesing]
  • Improve associations performance by using symbol callbacks instead of string callbacks. 11108 [adymo]
  • Optimise the BigDecimal conversion code. 11110 [adymo]
  • Introduce the :readonly option to all associations. Records from the association cannot be saved. 11084 [Emilio Tagua]
  • Multiparameter attributes for time columns fail over to DateTime when out of range of Time [Geoff Buesing]
  • Base#instantiate_time_object uses Time.zone.local() [Geoff Buesing]
  • Add timezone-aware attribute readers and writers. 10982 [Geoff Buesing]
  • Instantiating time objects in multiparameter attributes uses Time.zone if available. 10982 [Rick Olson]
  • Add note about how ActiveRecord::Observer classes are initialized in a Rails app. 10980 [Xavier Noria]
  • MySQL: omit text/blob defaults from the schema instead of using an empty string. 10963 [mdeiters]
  • belongs_to supports :dependent => :destroy and :delete. 10592 [Jonathan Viney]
  • Introduce preload query strategy for eager :includes. 9640 [Frederick Cheung, Aliaksey Kandratsenka, codafoo]
  • Support aggregations in finder conditions. 10572 [Ryan Kinderman]
  • Organize and clean up the Active Record test suite. 10742 [John Barnette]
  • Ensure that modifying has_and_belongs_to_many actions clear the query cache. Closes 10840 [john.andrews]
  • Fix issue where Table#references doesn‘t pass a :null option to a *_type attribute for polymorphic associations. Closes 10753 [railsjitsu]
  • Fixtures: removed support for the ancient pre-YAML file format. 10736 [John Barnette]
  • More thoroughly quote table names. 10698 [dimdenis, lotswholetime, Jeremy Kemper]
  • update_all ignores scoped :order and :limit, so post.comments.update_all doesn‘t try to include the comment order in the update statement. 10686 [Brendan Ribera]
  • Added ActiveRecord::Base.cache_key to make it easier to cache Active Records in combination with the new ActiveSupport::Cache::* libraries [David Heinemeier Hansson]
  • Make sure CSV fixtures are compatible with ruby 1.9‘s new csv implementation. [JEG2]
  • Added by parameter to increment, decrement, and their bang varieties so you can do player1.increment!(:points, 5) 10542 [Sam]
  • Optimize ActiveRecord::Base#exists? to use select_all instead of find. Closes 10605 [jamesh, Frederick Cheung, protocool]
  • Don‘t unnecessarily load has_many associations in after_update callbacks. Closes 6822 [stopdropandrew, canadaduane]
  • Eager belongs_to :include infers the foreign key from the association name rather than the class name. 10517 [Jonathan Viney]
  • SQLite: fix rename_ and remove_column for columns with unique indexes. 10576 [Brandon Keepers]
  • Ruby 1.9 compatibility. 10655 [Jeremy Kemper, Dirkjan Bussink]

*2.0.2* (December 16th, 2007)

  • Ensure optimistic locking handles nil lock_version values properly. Closes 10510 [Rick Olson]
  • Make the Fixtures Test::Unit enhancements more supporting for double-loaded test cases. Closes 10379 [brynary]
  • Fix that validates_acceptance_of still works for non-existent tables (useful for bootstrapping new databases). Closes 10474 [Josh Susser]
  • Ensure that the :uniq option for has_many :through associations retains the order. 10463 [remvee]
  • Base.exists? doesn‘t rescue exceptions to avoid hiding SQL errors. 10458 [Michael Klishin]
  • Documentation: Active Record exceptions, destroy_all and delete_all. 10444, 10447 [Michael Klishin]

*2.0.1* (December 7th, 2007)

  • Removed query cache rescue as it could cause code to be run twice (closes 10408) [David Heinemeier Hansson]

*2.0.0* (December 6th, 2007)

  • Anchor DateTimeTest to fixed DateTime instead of a variable value based on Time.now#advance#to_datetime, so that this test passes on 64-bit platforms running Ruby 1.8.6+ [Geoff Buesing]
  • Fixed that the Query Cache should just be ignored if the database is misconfigured (so that the "About your applications environment" works even before the database has been created) [David Heinemeier Hansson]
  • Fixed that the truncation of strings longer than 50 chars should use inspect

so newlines etc are escaped 10385 [Norbert Crombach]

  • Fixed that habtm associations should be able to set :select as part of their definition and have that honored [David Heinemeier Hansson]
  • Document how the :include option can be used in Calculations::calculate. Closes 7446 [adamwiggins, ultimoamore]
  • Fix typo in documentation for polymorphic associations w/STI. Closes 7461 [johnjosephbachir]
  • Reveal that the type option in migrations can be any supported column type for your database but also include caveat about agnosticism. Closes 7531 [adamwiggins, mikong]
  • More complete documentation for find_by_sql. Closes 7912 [fearoffish]
  • Added ActiveRecord::Base#becomes to turn a record into one of another class (mostly relevant for STIs) [David Heinemeier Hansson]. Example:
      render :partial => @client.becomes(Company) # renders companies/company instead of clients/client
    
  • Fixed that to_xml should not automatically pass :procs to associations included with :include 10162 [Cheah Chu Yeow]
  • Fix documentation typo introduced in [8250]. Closes 10339 [Henrik N]
  • Foxy fixtures: support single-table inheritance. 10234 [tom]
  • Foxy fixtures: allow mixed usage to make migration easier and more attractive. 10004 [lotswholetime]
  • Make the record_timestamps class-inheritable so it can be set per model. 10004 [tmacedo]
  • Allow validates_acceptance_of to use a real attribute instead of only virtual (so you can record that the acceptance occured) 7457 [ambethia]
  • DateTimes use Ruby‘s default calendar reform setting. 10201 [Geoff Buesing]
  • Dynamic finders on association collections respect association :order and :limit. 10211, 10227 [Patrick Joyce, Rick Olson, Jack Danger Canty]
  • Add ‘foxy’ support for fixtures of polymorphic associations. 10183 [John Barnette, David Lowenfels]
  • validates_inclusion_of and validates_exclusion_of allow formatted :message strings. 8132 [devrieda, Mike Naberezny]
  • attr_readonly behaves well with optimistic locking. 10188 [Nick Bugajski]
  • Base#to_xml supports the nil="true" attribute like Hash#to_xml. 8268 [Jonathan del Strother]
  • Change plings to the more conventional quotes in the documentation. Closes 10104 [Jack Danger Canty]
  • Fix HasManyThrough Association so it uses :conditions on the HasMany Association. Closes 9729 [Jack Danger Canty]
  • Ensure that column names are quoted. Closes 10134 [wesley.moxam]
  • Smattering of grammatical fixes to documentation. Closes 10083 [Bob Silva]
  • Enhance explanation with more examples for attr_accessible macro. Closes 8095 [fearoffish, Marcel Molina Jr.]
  • Update association/method mapping table to refected latest collection methods for has_many :through. Closes 8772 [Pratik Naik]
  • Explain semantics of having several different AR instances in a transaction block. Closes 9036 [jacobat, Marcel Molina Jr.]
  • Update Schema documentation to use updated sexy migration notation. Closes 10086 [Sam Granieri]
  • Make fixtures work with the new test subclasses. [Tarmo Tänav, Michael Koziarski]
  • Introduce finder :joins with associations. Same :include syntax but with inner rather than outer joins. 10012 [RubyRedRick]
      # Find users with an avatar
      User.find(:all, :joins => :avatar)
    
      # Find posts with a high-rated comment.
      Post.find(:all, :joins => :comments, :conditions => 'comments.rating > 3')
    
  • Associations: speedup duplicate record check. 10011 [Pratik Naik]
  • Make sure that << works on has_many associations on unsaved records. Closes 9989 [Josh Susser]
  • Allow association redefinition in subclasses. 9346 [wildchild]
  • Fix has_many :through delete with custom foreign keys. 6466 [naffis]
  • Foxy fixtures, from rathole (svn.geeksomnia.com/rathole/trunk/README)
      - stable, autogenerated IDs
      - specify associations (belongs_to, has_one, has_many) by label, not ID
      - specify HABTM associations as inline lists
      - autofill timestamp columns
      - support YAML defaults
      - fixture label interpolation
    

    Enabled for fixtures that correspond to a model class and don‘t specify a primary key value. 9981 [John Barnette]

  • Add docs explaining how to protect all attributes using attr_accessible with no arguments. Closes 9631 [boone, rmm5t]
  • Update add_index documentation to use new options api. Closes 9787 [Kamal Fariz Mahyuddin]
  • Allow find on a has_many association defined with :finder_sql to accept id arguments as strings like regular find does. Closes 9916 [krishna]
  • Use VALID_FIND_OPTIONS when resolving :find scoping rather than hard coding the list of valid find options. Closes 9443 [sur]
  • Limited eager loading no longer ignores scoped :order. Closes 9561 [Jack Danger Canty, Josh Peek]
  • Assigning an instance of a foreign class to a composed_of aggregate calls an optional conversion block. Refactor and simplify composed_of implementation. 6322 [brandon, Chris Cruft]
  • Assigning nil to a composed_of aggregate also sets its immediate value to nil. 9843 [Chris Cruft]
  • Ensure that mysql quotes table names with database names correctly. Closes 9911 [crayz]

    "foo.bar" => "`foo`.`bar`"

  • Complete the assimilation of Sexy Migrations from ErrFree [Chris Wanstrath, PJ Hyett]
          http://errtheblog.com/post/2381
    
  • Qualified column names work in hash conditions, like :conditions => { ‘comments.created_at’ => … }. 9733 [Jack Danger Canty]
  • Fix regression where the association would not construct new finder SQL on save causing bogus queries for "WHERE owner_id = NULL" even after owner was saved. 8713 [Bryan Helmkamp]
  • Refactor association create and build so before & after callbacks behave consistently. 8854 [Pratik Naik, mortent]
  • Quote table names. Defaults to column quoting. 4593 [Justin Lynn, gwcoffey, eadz, Dmitry V. Sabanin, Jeremy Kemper]
  • Alias association build to new so it behaves predictably. 8787 [Pratik Naik]
  • Add notes to documentation regarding attr_readonly behavior with counter caches and polymorphic associations. Closes 9835 [saimonmoore, Rick Olson]
  • Observers can observe model names as symbols properly now. Closes 9869 [queso]
  • find_and_(initialize|create)_by methods can now properly initialize protected attributes [Tobias Lütke]
  • belongs_to infers the foreign key from the association name instead of from the class name. [Jeremy Kemper]
  • PostgreSQL: support multiline default values. 7533 [Carl Lerche, aguynamedryan, Rein Henrichs, Tarmo Tänav]
  • MySQL: fix change_column on not-null columns that don‘t accept dfeault values of ’’. 6663 [Jonathan Viney, Tarmo Tänav]
  • validates_uniqueness_of behaves well with abstract superclasses and

single-table inheritance. 3833, 9886 [Gabriel Gironda, rramdas, François Beausoleil, Josh Peek, Tarmo Tänav, pat]

  • Warn about protected attribute assigments in development and test environments when mass-assigning to an attr_protected attribute. 9802 [Henrik N]
  • Speedup database date/time parsing. [Jeremy Kemper, Tarmo Tänav]
  • Fix calling .clear on a has_many :dependent=>:delete_all association. [Tarmo Tänav]
  • Allow change_column to set NOT NULL in the PostgreSQL adapter [Tarmo Tänav]
  • Fix that ActiveRecord would create attribute methods and override custom attribute getters if the method is also defined in Kernel.methods. [Rick Olson]
  • Don‘t call attr_readonly on polymorphic belongs_to associations, in case it matches the name of some other non-ActiveRecord class/module. [Rick Olson]
  • Try loading activerecord-<adaptername>-adapter gem before trying a plain require so you can use custom gems for the bundled adapters. Also stops gems from requiring an adapter from an old Active Record gem. [Jeremy Kemper, Derrick Spell]

*2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.14.2 - 1.15.3]

  • Add attr_readonly to specify columns that are skipped during a normal ActiveRecord save operation. Closes 6896 [Dan Manges]

    class Comment < ActiveRecord::Base

      # Automatically sets Article#comments_count as readonly.
      belongs_to :article, :counter_cache => :comments_count
    

    end

    class Article < ActiveRecord::Base

      attr_readonly :approved_comments_count
    

    end

  • Make size for has_many :through use counter cache if it exists. Closes 9734 [Xavier Shay]
  • Remove DB2 adapter since IBM chooses to maintain their own adapter instead. [Jeremy Kemper]
  • Extract Oracle, SQLServer, and Sybase adapters into gems. [Jeremy Kemper]
  • Added fixture caching that‘ll speed up a normal fixture-powered test suite between 50% and 100% 9682 [Frederick Cheung]
  • Correctly quote id list for limited eager loading. 7482 [tmacedo]
  • Fixed that using version-targetted migrates would fail on loggers other than the default one 7430 [valeksenko]
  • Fixed rename_column for SQLite when using symbols for the column names 8616 [drodriguez]
  • Added the possibility of using symbols in addition to concrete classes with ActiveRecord::Observer#observe. 3998 [Robby Russell, Tarmo Tänav]
  • Added ActiveRecord::Base#to_json/from_json [David Heinemeier Hansson, Cheah Chu Yeow]
  • Added ActiveRecord::Base#from_xml [David Heinemeier Hansson]. Example:
      xml = "<person><name>David</name></person>"
      Person.new.from_xml(xml).name # => "David"
    
  • Define dynamic finders as real methods after first usage. [bscofield]
  • Deprecation: remove deprecated threaded_connections methods. Use allow_concurrency instead. [Jeremy Kemper]
  • Associations macros accept extension blocks alongside modules. 9346 [Josh Peek]
  • Speed up and simplify query caching. [Jeremy Kemper]
  • connection.select_rows ‘sql’ returns an array (rows) of arrays (field values). 2329 [Michael Schuerig]
  • Eager loading respects explicit :joins. 9496 [dasil003]
  • Extract Firebird, FrontBase, and OpenBase adapters into gems. 9508, 9509, 9510 [Jeremy Kemper]
  • RubyGem database adapters: expects a gem named activerecord-<database>-adapter with active_record/connection_adapters/<database>_adapter.rb in its load path. [Jeremy Kemper]
  • Fixed that altering join tables in migrations would fail w/ sqlite3 7453 [TimoMihaljov/brandon]
  • Fix association writer with :dependent => :nullify. 7314 [Jonathan Viney]
  • OpenBase: update for new lib and latest Rails. Support migrations. 8748 [dcsesq]
  • Moved acts_as_tree into a plugin of the same name on the official Rails svn. 9514 [Pratik Naik]
  • Moved acts_as_nested_set into a plugin of the same name on the official Rails svn. 9516 [Josh Peek]
  • Moved acts_as_list into a plugin of the same name on the official Rails svn. [Josh Peek]
  • Explicitly require active_record/query_cache before using it. [Jeremy Kemper]
  • Fix bug where unserializing an attribute attempts to modify a frozen @attributes hash for a deleted record. [Rick Olson, marclove]
  • Performance: absorb instantiate and initialize_with_callbacks into the Base methods. [Jeremy Kemper]
  • Fixed that eager loading queries and with_scope should respect the :group option [David Heinemeier Hansson]
  • Improve performance and functionality of the postgresql adapter. Closes 8049 [roderickvd]
          For more information see: http://dev.rubyonrails.org/ticket/8049
    
  • Don‘t clobber includes passed to has_many.count [Jack Danger Canty]
  • Make sure has_many uses :include when counting [Jack Danger Canty]
  • Change the implementation of ActiveRecord‘s attribute reader and writer methods [Michael Koziarski]
 - Generate Reader and Writer methods which cache attribute values in hashes.  This is to avoid repeatedly parsing the same date or integer columns.
 - Change exception raised when users use find with :select then try to access a skipped column.  Plugins could override missing_attribute() to lazily load the columns.
 - Move method definition to the class, instead of the instance
 - Always generate the readers, writers and predicate methods.
  • Perform a deep dup on query cache results so that modifying activerecord attributes does not modify the cached attributes. [Rick Olson]

# Ensure that has_many :through associations use a count query instead of loading the target when size is called. Closes 8800 [Pratik Naik]

  • Added :unless clause to validations 8003 [monki]. Example:
      def using_open_id?
        !identity_url.blank?
      end
    
      validates_presence_of :identity_url, :if => using_open_id?
      validates_presence_of :username, :unless => using_open_id?
      validates_presence_of :password, :unless => using_open_id?
    
  • Fix count on a has_many :through association so that it recognizes the :uniq option. Closes 8801 [Pratik Naik]
  • Fix and properly document/test count(column_name) usage. Closes 8999 [Pratik Naik]
  • Remove deprecated count(conditions=nil, joins=nil) usage. Closes 8993 [Pratik Naik]
  • Change belongs_to so that the foreign_key assumption is taken from the association name, not the class name. Closes 8992 [Josh Susser]

    OLD

      belongs_to :visitor, :class_name => 'User' # => inferred foreign_key is user_id
    

    NEW

      belongs_to :visitor, :class_name => 'User' # => inferred foreign_key is visitor_id
    
  • Remove spurious tests from deprecated_associations_test, most of these aren‘t deprecated, and are duplicated in associations_test. Closes 8987 [Pratik Naik]
  • Make create! on a has_many :through association return the association object. Not the collection. Closes 8786 [Pratik Naik]
  • Move from select * to select tablename.* to avoid clobbering IDs. Closes 8889 [dasil003]
  • Don‘t call unsupported methods on associated objects when using :include, :method with to_xml 7307, [Manfred Stienstra, jwilger]
  • Define collection singular ids method for has_many :through associations. 8763 [Pratik Naik]
  • Array attribute conditions work with proxied association collections. 8318 [Kamal Fariz Mahyuddin, theamazingrando]
  • Fix polymorphic has_one associations declared in an abstract class. 8638 [Pratik Naik, Dax Huiberts]
  • Fixed validates_associated should not stop on the first error. 4276 [mrj, Manfred Stienstra, Josh Peek]
  • Rollback if commit raises an exception. 8642 [kik, Jeremy Kemper]
  • Update tests’ use of fixtures for the new collections api. 8726 [Kamal Fariz Mahyuddin]
  • Save associated records only if the association is already loaded. 8713 [Blaine]
  • MySQL: fix show_variable. 8448 [matt, Jeremy Kemper]
  • Fixtures: correctly delete and insert fixtures in a single transaction. 8553 [Michael Schuerig]
  • Fixtures: people(:technomancy, :josh) returns both fixtures. 7880 [technomancy, Josh Peek]
  • Calculations support non-numeric foreign keys. 8154 [Kamal Fariz Mahyuddin]
  • with_scope is protected. 8524 [Josh Peek]
  • Quickref for association methods. 7723 [marclove, Mindsweeper]
  • Calculations: return nil average instead of 0 when there are no rows to average. 8298 [davidw]
  • acts_as_nested_set: direct_children is sorted correctly. 4761 [Josh Peek, rails@33lc0.net]
  • Raise an exception if both attr_protected and attr_accessible are declared. 8507 [stellsmi]
  • SQLite, MySQL, PostgreSQL, Oracle: quote column names in column migration SQL statements. 8466 [marclove, lorenjohnson]
  • Allow nil serialized attributes with a set class constraint. 7293 [sandofsky]
  • Oracle: support binary fixtures. 7987 [Michael Schoen]
  • Fixtures: pull fixture insertion into the database adapters. 7987 [Michael Schoen]
  • Announce migration versions as they‘re performed. [Jeremy Kemper]
  • find gracefully copes with blank :conditions. 7599 [Dan Manges, johnnyb]
  • validates_numericality_of takes :greater_than, :greater_than_or_equal_to, :equal_to, :less_than, :less_than_or_equal_to, :odd, and :even options. 3952 [Bob Silva, Dan Kubb, Josh Peek]
  • MySQL: create_database takes :charset and :collation options. Charset defaults to utf8. 8448 [matt]
  • Find with a list of ids supports limit/offset. 8437 [hrudududu]
  • Optimistic locking: revert the lock version when an update fails. 7840 [plang]
  • Migrations: add_column supports custom column types. 7742 [jsgarvin, Theory]
  • Load database adapters on demand. Eliminates config.connection_adapters and RAILS_CONNECTION_ADAPTERS. Add your lib directory to the $LOAD_PATH and put your custom adapter in lib/active_record/connection_adapters/adaptername_adapter.rb. This way you can provide custom adapters as plugins or gems without modifying Rails. [Jeremy Kemper]
  • Ensure that associations with :dependent => :delete_all respect :conditions option. Closes 8034 [Jack Danger Canty, Josh Peek, Rick Olson]
  • belongs_to assignment creates a new proxy rather than modifying its target in-place. 8412 [mmangino@elevatedrails.com]
  • Fix column type detection while loading fixtures. Closes 7987 [roderickvd]
  • Document deep eager includes. 6267 [Josh Susser, Dan Manges]
  • Document warning that associations names shouldn‘t be reserved words. 4378 [murphy@cYcnus.de, Josh Susser]
  • Sanitize Base#inspect. 8392, 8623 [Nik Wakelin, jnoon]
  • Replace the transaction {|transaction|..} semantics with a new Exception ActiveRecord::Rollback. [Michael Koziarski]
  • Oracle: extract column length for CHAR also. 7866 [ymendel]
  • Document :allow_nil option for validates_acceptance_of since it defaults to true. [tzaharia]
  • Update documentation for :dependent declaration so that it explicitly uses the non-deprecated API. [Jack Danger Canty]
  • Add documentation caveat about when to use count_by_sql. [fearoffish]
  • Enhance documentation for increment_counter and decrement_counter. [fearoffish]
  • Provide brief introduction to what optimistic locking is. [fearoffish]
  • Add documentation for :encoding option to mysql adapter. [marclove]
  • Added short-hand declaration style to migrations (inspiration from Sexy Migrations, errtheblog.com/post/2381) [David Heinemeier Hansson]. Example:
      create_table "products" do |t|
        t.column "shop_id",    :integer
        t.column "creator_id", :integer
        t.column "name",       :string,   :default => "Untitled"
        t.column "value",      :string,   :default => "Untitled"
        t.column "created_at", :datetime
        t.column "updated_at", :datetime
      end
    

    …can now be written as:

      create_table :products do |t|
        t.integer :shop_id, :creator_id
        t.string  :name, :value, :default => "Untitled"
        t.timestamps
      end
    
  • Use association name for the wrapper element when using .to_xml. Previous behavior lead to non-deterministic situations with STI and polymorphic associations. [Michael Koziarski, jstrachan]
  • Improve performance of calling .create on has_many :through associations. [evan]
  • Improved cloning performance by relying less on exception raising 8159 [Blaine]
  • Added ActiveRecord::Base.inspect to return a column-view like #<Post id:integer, title:string, body:text> [David Heinemeier Hansson]
  • Added yielding of Builder instance for ActiveRecord::Base#to_xml calls [David Heinemeier Hansson]
  • Small additions and fixes for ActiveRecord documentation. Closes 7342 [Jeremy McAnally]
  • Add helpful debugging info to the ActiveRecord::StatementInvalid exception in ActiveRecord::ConnectionAdapters::SqliteAdapter#table_structure. Closes 7925. [court3nay]
  • SQLite: binary escaping works with $KCODE=’u’. 7862 [tsuka]
  • Base#to_xml supports serialized attributes. 7502 [jonathan]
  • Base.update_all :order and :limit options. Useful for MySQL updates that must be ordered to avoid violating unique constraints. [Jeremy Kemper]
  • Remove deprecated object transactions. People relying on this functionality should install the object_transactions plugin at code.bitsweat.net/svn/object_transactions. Closes 5637 [Michael Koziarski, Jeremy Kemper]
  • PostgreSQL: remove DateTime -> Time downcast. Warning: do not enable translate_results for the C bindings if you have timestamps outside Time‘s domain. [Jeremy Kemper]
  • find_or_create_by_* takes a hash so you can create with more attributes than are in the method name. For example, Person.find_or_create_by_name(:name => ‘Henry’, :comments => ‘Hi new user!’) is equivalent to Person.find_by_name(‘Henry’) || Person.create(:name => ‘Henry’, :comments => ‘Hi new user!’). 7368 [Josh Susser]
  • Make sure with_scope takes both :select and :joins into account when setting :readonly. Allows you to save records you retrieve using method_missing on a has_many :through associations. [Michael Koziarski]
  • Allow a polymorphic :source for has_many :through associations. Closes 7143 [protocool]
  • Consistent public/protected/private visibility for chained methods. 7813 [Dan Manges]
  • Oracle: fix quoted primary keys and datetime overflow. 7798 [Michael Schoen]
  • Consistently quote primary key column names. 7763 [toolmantim]
  • Fixtures: fix YAML ordered map support. 2665 [Manuel Holtgrewe, nfbuckley]
  • DateTimes assume the default timezone. 7764 [Geoff Buesing]
  • Sybase: hide timestamp columns since they‘re inherently read-only. 7716 [Mike Joyce]
  • Oracle: overflow Time to DateTime. 7718 [Michael Schoen]
  • PostgreSQL: don‘t use async_exec and async_query with postgres-pr. 7727, 7762 [flowdelic, toolmantim]
  • Fix has_many :through << with custom foreign keys. 6466, 7153 [naffis, Rich Collins]
  • Test DateTime native type in migrations, including an edge case with dates

during calendar reform. 7649, 7724 [fedot, Geoff Buesing]

  • SQLServer: correctly schema-dump tables with no indexes or descending indexes. 7333, 7703 [Jakob Skjerning, Tom Ward]
  • SQLServer: recognize real column type as Ruby float. 7057 [sethladd, Tom Ward]
  • Added fixtures :all as a way of loading all fixtures in the fixture directory at once 7214 [Manfred Stienstra]
  • Added database connection as a yield parameter to ActiveRecord::Base.transaction so you can manually rollback [David Heinemeier Hansson]. Example:
      transaction do |transaction|
        david.withdrawal(100)
        mary.deposit(100)
        transaction.rollback! # rolls back the transaction that was otherwise going to be successful
      end
    
  • Made increment_counter/decrement_counter play nicely with optimistic locking, and added a more general update_counters method [Jamis Buck]
  • Reworked David‘s query cache to be available as Model.cache {…}. For the duration of the block no select query should be run more then once. Any inserts/deletes/executes will flush the whole cache however [Tobias Lütke] Task.cache { Task.find(1); Task.find(1) } #=> 1 query
  • When dealing with SQLite3, use the table_info pragma helper, so that the bindings can do some translation for when sqlite3 breaks incompatibly between point releases. [Jamis Buck]
  • Oracle: fix lob and text default handling. 7344 [gfriedrich, Michael Schoen]
  • SQLServer: don‘t choke on strings containing ‘null’. 7083 [Jakob Skjerning]
  • MySQL: blob and text columns may not have defaults in 5.x. Update fixtures schema for strict mode. 6695 [Dan Kubb]
  • update_all can take a Hash argument. sanitize_sql splits into two methods for conditions and assignment since NULL values and delimiters are handled differently. 6583, 7365 [sandofsky, Assaf]
  • MySQL: SET SQL_AUTO_IS_NULL=0 so ‘where id is null’ doesn‘t select the last inserted id. 6778 [Jonathan Viney, timc]
  • Use Date#to_s(:db) for quoted dates. 7411 [Michael Schoen]
  • Don‘t create instance writer methods for class attributes. Closes 7401 [Rick Olson]
  • Docs: validations examples. 7343 [zackchandler]
  • Add missing tests ensuring callbacks work with class inheritance. Closes 7339 [sandofsky]
  • Fixtures use the table name and connection from set_fixture_class. 7330 [Anthony Eden]
  • Remove useless code in attribute_present? since 0 != blank?. Closes 7249 [Josh Susser]
  • Fix minor doc typos. Closes 7157 [Josh Susser]
  • Fix incorrect usage of classify when creating the eager loading join statement. Closes 7044 [Josh Susser]
  • SQLServer: quote table name in indexes query. 2928 [keithm@infused.org]
  • Subclasses of an abstract class work with single-table inheritance. 5704, 7284 [BertG, nick+rails@ag.arizona.edu]
  • Make sure sqlite3 driver closes open connections on disconnect [Rob Rasmussen]
  • [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name. 7072 [Jeremy McAnally]
  • change_column accepts :default => nil. Skip column options for primary keys. 6956, 7048 [Dan Manges, Jeremy Kemper]
  • MySQL, PostgreSQL: change_column_default quotes the default value and doesn‘t lose column type information. 3987, 6664 [Jonathan Viney, Manfred Stienstra, altano@bigfoot.com]
  • Oracle: create_table takes a :sequence_name option to override the ‘tablename_seq’ default. 7000 [Michael Schoen]
  • MySQL: retain SSL settings on reconnect. 6976 [randyv2]
  • Apply scoping during initialize instead of create. Fixes setting of foreign key when using find_or_initialize_by with scoping. [Cody Fauser]
  • SQLServer: handle [quoted] table names. 6635 [rrich]
  • acts_as_nested_set works with single-table inheritance. 6030 [Josh Susser]
  • PostgreSQL, Oracle: correctly perform eager finds with :limit and :order. 4668, 7021 [eventualbuddha, Michael Schoen]
  • Pass a range in :conditions to use the SQL BETWEEN operator. 6974 [Dan Manges]
      Student.find(:all, :conditions => { :grade => 9..12 })
    
  • Fix the Oracle adapter for serialized attributes stored in CLOBs. Closes 6825 [mschoen, tdfowler]
  • [DOCS] Apply more documentation for ActiveRecord Reflection. Closes 4055 [Robby Russell]
  • [DOCS] Document :allow_nil option of validate_uniqueness_of. Closes 3143 [Caio Chassot]
  • Bring the sybase adapter up to scratch for 1.2 release. [jsheets]
  • Rollback new_record? and id when an exception is raised in a save callback. 6910 [Ben Curren, outerim]
  • Pushing a record on an association collection doesn‘t unnecessarily load all the associated records. [Obie Fernandez, Jeremy Kemper]
  • Oracle: fix connection reset failure. 6846 [leonlleslie]
  • Subclass instantiation doesn‘t try to explicitly require the corresponding subclass. 6840 [leei, Jeremy Kemper]
  • fix faulty inheritance tests and that eager loading grabs the wrong inheritance column when the class of your association is an STI subclass. Closes 6859 [protocool]
  • Consolidated different create and create! versions to call through to the base class with scope. This fixes inconsistencies, especially related to protected attribtues. Closes 5847 [Alexander Dymo, Tobias Lütke]
  • find supports :lock with :include. Check whether your database allows SELECT … FOR UPDATE with outer joins before using. 6764 [vitaly, Jeremy Kemper]
  • Add AssociationCollection#create! to be consistent with AssociationCollection#create when dealing with a foreign key that is a protected attribute [Cody Fauser]
  • Added counter optimization for AssociationCollection#any? so person.friends.any? won‘t actually load the full association if we have the count in a cheaper form [David Heinemeier Hansson]
  • Change fixture_path to a class inheritable accessor allowing test cases to have their own custom set of fixtures. 6672 [Zach Dennis]
  • Quote ActiveSupport::Multibyte::Chars. 6653 [Julian Tarkhanov]
  • Simplify query_attribute by typecasting the attribute value and checking whether it‘s nil, false, zero or blank. 6659 [Jonathan Viney]
  • validates_numericality_of uses \A \Z to ensure the entire string matches rather than ^ $ which may match one valid line of a multiline string. 5716 [Andreas Schwarz]
  • Run validations in the order they were declared. 6657 [obrie]
  • MySQL: detect when a NOT NULL column without a default value is misreported as default ’’. Can‘t detect for string, text, and binary columns since ’’ is a legitimate default. 6156 [simon@redhillconsulting.com.au, obrie, Jonathan Viney, Jeremy Kemper]
  • Simplify association proxy implementation by factoring construct_scope out of method_missing. 6643 [martin]
  • Oracle: automatically detect the primary key. 6594 [vesaria, Michael Schoen]
  • Oracle: to increase performance, prefetch 100 rows and enable similar cursor sharing. Both are configurable in database.yml. 6607 [philbogle@gmail.com, ray.fortna@jobster.com, Michael Schoen]
  • Don‘t inspect unloaded associations. 2905 [lmarlow]
  • SQLite: use AUTOINCREMENT primary key in >= 3.1.0. 6588, 6616 [careo, lukfugl]
  • Cache inheritance_column. 6592 [Stefan Kaes]
  • Firebird: decimal/numeric support. 6408 [macrnic]
  • make add_order a tad faster. 6567 [Stefan Kaes]
  • Find with :include respects scoped :order. 5850
  • Support nil and Array in :conditions => { attr => value } hashes. 6548 [Assaf, Jeremy Kemper]
      find(:all, :conditions => { :topic_id => [1, 2, 3], :last_read => nil }
    
  • Consistently use LOWER() for uniqueness validations (rather than mixing with UPPER()) so the database can always use a functional index on the lowercased column. 6495 [Si]
  • SQLite: fix calculations workaround, remove count(distinct) query rewrite, cleanup test connection scripts. [Jeremy Kemper]
  • SQLite: count(distinct) queries supported in >= 3.2.6. 6544 [Bob Silva]
  • Dynamically generate reader methods for serialized attributes. 6362 [Stefan Kaes]
  • Deprecation: object transactions warning. [Jeremy Kemper]
  • has_one :dependent => :nullify ignores nil associates. 4848, 6528 [bellis@deepthought.org, janovetz, Jeremy Kemper]
  • Oracle: resolve test failures, use prefetched primary key for inserts, check for null defaults, fix limited id selection for eager loading. Factor out some common methods from all adapters. 6515 [Michael Schoen]
  • Make add_column use the options hash with the Sqlite Adapter. Closes 6464 [obrie]
  • Document other options available to migration‘s add_column. 6419 [grg]
  • MySQL: all_hashes compatibility with old MysqlRes class. 6429, 6601 [Jeremy Kemper]
  • Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes 5783. [Jonathan Viney]
  • fix select_limited_ids_list issues in postgresql, retain current behavior in other adapters [Rick Olson]
  • Restore eager condition interpolation, document it‘s differences [Rick Olson]
  • Don‘t rollback in teardown unless a transaction was started. Don‘t start a transaction in create_fixtures if a transaction is started. 6282 [Jacob Fugal, Jeremy Kemper]
  • Add delete support to has_many :through associations. Closes 6049 [Martin Landers]
  • Reverted old select_limited_ids_list postgresql fix that caused issues in mysql. Closes 5851 [Rick Olson]
  • Removes the ability for eager loaded conditions to be interpolated, since there is no model instance to use as a context for interpolation. 5553 [turnip@turnipspatch.com]
  • Added timeout option to SQLite3 configurations to deal more gracefully with SQLite3::BusyException, now the connection can instead retry for x seconds to see if the db clears up before throwing that exception 6126 [wreese@gmail.com]
  • Added update_attributes! which uses save! to raise an exception if a validation error prevents saving 6192 [jonathan]
  • Deprecated add_on_boundary_breaking (use validates_length_of instead) 6292 [Bob Silva]
  • The has_many create method works with polymorphic associations. 6361 [Dan Peterson]
  • MySQL: introduce Mysql::Result#all_hashes to support further optimization. 5581 [Stefan Kaes]
  • save! shouldn‘t validate twice. 6324 [maiha, Bob Silva]
  • Association collections have an _ids reader method to match the existing writer for collection_select convenience (e.g. employee.task_ids). The writer method skips blank ids so you can safely do @employee.task_ids = params[:tasks] without checking every time for an empty list or blank values. 1887, 5780 [Michael Schuerig]
  • Add an attribute reader method for ActiveRecord::Base.observers [Rick Olson]
  • Deprecation: count class method should be called with an options hash rather than two args for conditions and joins. 6287 [Bob Silva]
  • has_one associations with a nil target may be safely marshaled. 6279 [norbauer, Jeremy Kemper]
  • Duplicate the hash provided to AR::Base#to_xml to prevent unexpected side effects [Michael Koziarski]
  • Add a :namespace option to AR::Base#to_xml [Michael Koziarski]
  • Deprecation tests. Remove warnings for dynamic finders and for the foo_count method if it‘s also an attribute. [Jeremy Kemper]
  • Mock Time.now for more accurate Touch mixin tests. 6213 [Dan Peterson]
  • Improve yaml fixtures error reporting. 6205 [Bruce Williams]
  • Rename AR::Base#quote so people can use that name in their models. 3628 [Michael Koziarski]
  • Add deprecation warning for inferred foreign key. 6029 [Josh Susser]
  • Fixed the Ruby/MySQL adapter we ship with Active Record to work with the new authentication handshake that was introduced in MySQL 4.1, along with the other protocol changes made at that time 5723 [jimw@mysql.com]
  • Deprecation: use :dependent => :delete_all rather than :exclusively_dependent => true. 6024 [Josh Susser]
  • Document validates_presences_of behavior with booleans: you probably want validates_inclusion_of :attr, :in => [true, false]. 2253 [Bob Silva]
  • Optimistic locking: gracefully handle nil versions, treat as zero. 5908 [Tom Ward]
  • to_xml: the :methods option works on arrays of records. 5845 [Josh Starcher]
  • Deprecation: update docs. 5998 [Jakob Skjerning, Kevin Clark]
  • Add some XmlSerialization tests for ActiveRecord [Rick Olson]
  • has_many :through conditions are sanitized by the associating class. 5971 [martin.emde@gmail.com]
  • Tighten rescue clauses. 5985 [james@grayproductions.net]
  • Fix spurious newlines and spaces in AR::Base#to_xml output [Jamis Buck]
  • has_one supports the :dependent => :delete option which skips the typical callback chain and deletes the associated object directly from the database. 5927 [Chris Mear, Jonathan Viney]
  • Nested subclasses are not prefixed with the parent class’ table_name since they should always use the base class’ table_name. 5911 [Jonathan Viney]
  • SQLServer: work around bug where some unambiguous date formats are not correctly identified if the session language is set to german. 5894 [Tom Ward, kruth@bfpi]
  • SQLServer: fix eager association test. 5901 [Tom Ward]
  • Clashing type columns due to a sloppy join shouldn‘t wreck single-table inheritance. 5838 [Kevin Clark]
  • Fixtures: correct escaping of \n and \r. 5859 [evgeny.zislis@gmail.com]
  • Migrations: gracefully handle missing migration files. 5857 [eli.gordon@gmail.com]
  • MySQL: update test schema for MySQL 5 strict mode. 5861 [Tom Ward]
  • to_xml: correct naming of included associations. 5831 [Josh Starcher]
  • Pushing a record onto a has_many :through sets the association‘s foreign key to the associate‘s primary key and adds it to the correct association. 5815, 5829 [Josh Susser]
  • Add records to has_many :through using <<, push, and concat by creating the association record. Raise if base or associate are new records since both ids are required to create the association. build raises since you can‘t associate an unsaved record. create! takes an attributes hash and creates the associated record and its association in a transaction. [Jeremy Kemper]
      # Create a tagging to associate the post and tag.
      post.tags << Tag.find_by_name('old')
      post.tags.create! :name => 'general'
    
      # Would have been:
      post.taggings.create!(:tag => Tag.find_by_name('finally')
      transaction do
        post.taggings.create!(:tag => Tag.create!(:name => 'general'))
      end
    
  • Cache nil results for :included has_one associations also. 5787 [Michael Schoen]
  • Fixed a bug which would cause .save to fail after trying to access a empty has_one association on a unsaved record. [Tobias Lütke]
  • Nested classes are given table names prefixed by the singular form of the parent‘s table name. [Jeremy Kemper]
      Example: Invoice::Lineitem is given table name invoice_lineitems
    
  • Migrations: uniquely name multicolumn indexes so you don‘t have to. [Jeremy Kemper]
      # people_active_last_name_index, people_active_deactivated_at_index
      add_index    :people, [:active, :last_name]
      add_index    :people, [:active, :deactivated_at]
      remove_index :people, [:active, :last_name]
      remove_index :people, [:active, :deactivated_at]
    

    WARNING: backward-incompatibility. Multicolumn indexes created before this revision were named using the first column name only. Now they‘re uniquely named using all indexed columns.

    To remove an old multicolumn index, remove_index :table_name, :first_column

  • Fix for deep includes on the same association. [richcollins@gmail.com]
  • Tweak fixtures so they don‘t try to use a non-ActiveRecord class. [Kevin Clark]
  • Remove ActiveRecord::Base.reset since Dispatcher doesn‘t use it anymore. [Rick Olson]
  • Document find‘s :from option. Closes 5762. [andrew@redlinesoftware.com]
  • PostgreSQL: autodetected sequences work correctly with multiple schemas. Rely on the schema search_path instead of explicitly qualifying the sequence name with its schema. 5280 [guy.naor@famundo.com]
  • Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
  • Cache nil results for has_one associations so multiple calls don‘t call the database. Closes 5757. [Michael Schoen]
  • Add documentation for how to disable timestamps on a per model basis. Closes 5684. [matt@mattmargolis.net Marcel Molina Jr.]
  • Don‘t save has_one associations unnecessarily. 5735 [Jonathan Viney]
  • Refactor ActiveRecord::Base.reset_subclasses to reset, and add global observer resetting. [Rick Olson]
  • Formally deprecate the deprecated finders. [Michael Koziarski]
  • Formally deprecate rich associations. [Michael Koziarski]
  • Fixed that default timezones for new / initialize should uphold utc setting 5709 [daniluk@yahoo.com]
  • Fix announcement of very long migration names. 5722 [blake@near-time.com]
  • The exists? class method should treat a string argument as an id rather than as conditions. 5698 [jeremy@planetargon.com]
  • Fixed to_xml with :include misbehaviors when invoked on array of model instances 5690 [alexkwolfe@gmail.com]
  • Added support for conditions on Base.exists? 5689 [Josh Peek]. Examples:
      assert (Topic.exists?(:author_name => "David"))
            assert (Topic.exists?(:author_name => "Mary", :approved => true))
            assert (Topic.exists?(["parent_id = ?", 1]))
    
  • Schema dumper quotes date :default values. [Dave Thomas]
  • Calculate sum with SQL, not Enumerable on HasManyThrough Associations. [Dan Peterson]
  • Factor the attribute#{suffix} methods out of method_missing for easier extension. [Jeremy Kemper]
  • Patch sql injection vulnerability when using integer or float columns. [Jamis Buck]
  • Allow count through a has_many association to accept :include. [Dan Peterson]
  • create_table rdoc: suggest :id => false for habtm join tables. [Zed Shaw]
  • PostgreSQL: return array fields as strings. 4664 [Robby Russell]
  • SQLServer: added tests to ensure all database statements are closed, refactored identity_insert management code to use blocks, removed update/delete rowcount code out of execute and into update/delete, changed insert to go through execute method, removed unused quoting methods, disabled pessimistic locking tests as feature is currently unsupported, fixed RakeFile to load sqlserver specific tests whether running in ado or odbc mode, fixed support for recently added decimal types, added support for limits on integer types. 5670 [Tom Ward]
  • SQLServer: fix db:schema:dump case-sensitivity. 4684 [Will Rogers]
  • Oracle: BigDecimal support. 5667 [Michael Schoen]
  • Numeric and decimal columns map to BigDecimal instead of Float. Those with scale 0 map to Integer. 5454 [robbat2@gentoo.org, work@ashleymoran.me.uk]
  • Firebird migrations support. 5337 [Ken Kunz <kennethkunz@gmail.com>]
  • PostgreSQL: create/drop as postgres user. 4790 [mail@matthewpainter.co.uk, mlaster@metavillage.com]
  • Update callbacks documentation. 3970 [Robby Russell <robby@planetargon.com>]
  • PostgreSQL: correctly quote the ’ in pk_and_sequence_for. 5462 [tietew@tietew.net]
  • PostgreSQL: correctly quote microseconds in timestamps. 5641 [rick@rickbradley.com]
  • Clearer has_one/belongs_to model names (account has_one :user). 5632 [matt@mattmargolis.net]
  • Oracle: use nonblocking queries if allow_concurrency is set, fix pessimistic locking, don‘t guess date vs. time by default (set OracleAdapter.emulate_dates = true for the old behavior), adapter cleanup. 5635 [Michael Schoen]
  • Fixed a few Oracle issues: Allows Oracle‘s odd date handling to still work consistently within to_xml, Passes test that hardcode insert statement by dropping the :id column, Updated RUNNING_UNIT_TESTS with Oracle instructions, Corrects method signature for exec 5294 [Michael Schoen]
  • Added :group to available options for finds done on associations 5516 [mike@michaeldewey.org]
  • Minor tweak to improve performance of ActiveRecord::Base#to_param.
  • Observers also watch subclasses created after they are declared. 5535 [daniels@pronto.com.au]
  • Removed deprecated timestamps_gmt class methods. [Jeremy Kemper]
  • rake build_mysql_database grants permissions to rails@localhost. 5501 [brianegge@yahoo.com]
  • PostgreSQL: support microsecond time resolution. 5492 [alex@msgpad.com]
  • Add AssociationCollection#sum since the method_missing invokation has been shadowed by Enumerable#sum.
  • Added find_or_initialize_by_X which works like find_or_create_by_X but doesn‘t save the newly instantiated record. [Sam Stephenson]
  • Row locking. Provide a locking clause with the :lock finder option or true for the default "FOR UPDATE". Use the lock! method to obtain a row lock on a single record (reloads the record with :lock => true). [Shugo Maeda]
      # Obtain an exclusive lock on person 1 so we can safely increment visits.
      Person.transaction do
        # select * from people where id=1 for update
        person = Person.find(1, :lock => true)
        person.visits += 1
        person.save!
      end
    
  • PostgreSQL: introduce allow_concurrency option which determines whether to use blocking or asynchronous execute. Adapters with blocking execute will deadlock Ruby threads. The default value is ActiveRecord::Base.allow_concurrency. [Jeremy Kemper]
  • Use a per-thread (rather than global) transaction mutex so you may execute concurrent transactions on separate connections. [Jeremy Kemper]
  • Change AR::Base#to_param to return a String instead of a Fixnum. Closes 5320. [Nicholas Seckar]
  • Use explicit delegation instead of method aliasing for AR::Base.to_param -> AR::Base.id. 5299 (skaes@web.de)
  • Refactored ActiveRecord::Base.to_xml to become a delegate for XmlSerializer, which restores sanity to the mega method. This refactoring also reinstates the opinions that type="string" is redundant and ugly and nil-differentiation is not a concern of serialization [David Heinemeier Hansson]
  • Added simple hash conditions to find that‘ll just convert hash to an AND-based condition string 5143 [Hampton Catlin]. Example:
      Person.find(:all, :conditions => { :last_name => "Catlin", :status => 1 }, :limit => 2)
    

…is the same as:

    Person.find(:all, :conditions => [ "last_name = ? and status = ?", "Catlin", 1 ], :limit => 2)

  This makes it easier to pass in the options from a form or otherwise outside.
  • Fixed issues with BLOB limits, charsets, and booleans for Firebird 5194, 5191, 5189 [kennethkunz@gmail.com]
  • Fixed usage of :limit and with_scope when the association in scope is a 1:m 5208 [alex@purefiction.net]
  • Fixed migration trouble with SQLite when NOT NULL is used in the new definition 5215 [greg@lapcominc.com]
  • Fixed problems with eager loading and counting on SQL Server 5212 [kajism@yahoo.com]
  • Fixed that count distinct should use the selected column even when using :include 5251 [anna@wota.jp]
  • Fixed that :includes merged from with_scope won‘t cause the same association to be loaded more than once if repetition occurs in the clauses 5253 [alex@purefiction.net]
  • Allow models to override to_xml. 4989 [Blair Zajac <blair@orcaware.com>]
  • PostgreSQL: don‘t ignore port when host is nil since it‘s often used to label the domain socket. 5247 [shimbo@is.naist.jp]
  • Records and arrays of records are bound as quoted ids. [Jeremy Kemper]
      Foo.find(:all, :conditions => ['bar_id IN (?)', bars])
      Foo.find(:first, :conditions => ['bar_id = ?', bar])
    
  • Fixed that Base.find :all, :conditions => [ "id IN (?)", collection ] would fail if collection was empty [David Heinemeier Hansson]
  • Add a list of regexes assert_queries skips in the ActiveRecord test suite. [Rick Olson]
  • Fix the has_and_belongs_to_many create doesn‘t populate the join for new records. Closes 3692 [Josh Susser]
  • Provide Association Extensions access to the instance that the association is being accessed from. Closes 4433 [Josh Susser]
  • Update OpenBase adaterp‘s maintainer‘s email address. Closes 5176. [Derrick Spell]
  • Add a quick note about :select and eagerly included associations. [Rick Olson]
  • Add docs for the :as option in has_one associations. Closes 5144 [cdcarter@gmail.com]
  • Fixed that has_many collections shouldn‘t load the entire association to do build or create [David Heinemeier Hansson]
  • Added :allow_nil option for aggregations 5091 [Ian White]
  • Fix Oracle boolean support and tests. Closes 5139. [Michael Schoen]
  • create! no longer blows up when no attributes are passed and a :create scope is in effect (e.g. foo.bars.create! failed whereas foo.bars.create!({}) didn‘t.) [Jeremy Kemper]
  • Call Inflector#demodulize on the class name when eagerly including an STI model. Closes 5077 [info@loobmedia.com]
  • Preserve MySQL boolean column defaults when changing a column in a migration. Closes 5015. [pdcawley@bofh.org.uk]
  • PostgreSQL: migrations support :limit with :integer columns by mapping limit < 4 to smallint, > 4 to bigint, and anything else to integer. 2900 [keegan@thebasement.org]
  • Dates and times interpret empty strings as nil rather than 2000-01-01. 4830 [kajism@yahoo.com]
  • Allow :uniq => true with has_many :through associations. [Jeremy Kemper]
  • Ensure that StringIO is always available for the Schema dumper. [Marcel Molina Jr.]
  • Allow AR::Base#to_xml to include methods too. Closes 4921. [johan@textdrive.com]
  • Replace superfluous name_to_class_name variant with camelize. [Marcel Molina Jr.]
  • Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
  • Replace Ruby‘s deprecated append_features in favor of included. [Marcel Molina Jr.]
  • Remove duplicate fixture entry in comments.yml. Closes 4923. [Blair Zajac <blair@orcaware.com>]
  • Update FrontBase adapter to check binding version. Closes 4920. [mlaster@metavillage.com]
  • New Frontbase connections don‘t start in auto-commit mode. Closes 4922. [mlaster@metavillage.com]
  • When grouping, use the appropriate option key. [Marcel Molina Jr.]
  • Only modify the sequence name in the FrontBase adapter if the FrontBase adapter is actually being used. [Marcel Molina Jr.]
  • Add support for FrontBase (www.frontbase.com/) with a new adapter thanks to the hard work of one Mike Laster. Closes 4093. [mlaster@metavillage.com]
  • Add warning about the proper way to validate the presence of a foreign key. Closes 4147. [Francois Beausoleil <francois.beausoleil@gmail.com>]
  • Fix syntax error in documentation. Closes 4679. [Mislav Marohnić]
  • Add Oracle support for CLOB inserts. Closes 4748. [schoenm@earthlink.net sandra.metz@duke.edu]
  • Various fixes for sqlserver_adapter (odbc statement finishing, ado schema dumper, drop index). Closes 4831. [kajism@yahoo.com]
  • Add support for :order option to with_scope. Closes 3887. [eric.daspet@survol.net]
  • Prettify output of schema_dumper by making things line up. Closes 4241 [Caio Chassot <caio@v2studio.com>]
  • Make build_postgresql_databases task make databases owned by the postgres user. Closes 4790. [mlaster@metavillage.com]
  • Sybase Adapter type conversion cleanup. Closes 4736. [dev@metacasa.net]
  • Fix bug where calculations with long alias names return null. [Rick Olson]
  • Raise error when trying to add to a has_many :through association. Use the Join Model instead. [Rick Olson]
      @post.tags << @tag                  # BAD
      @post.taggings.create(:tag => @tag) # GOOD
    
  • Allow all calculations to take the :include option, not just COUNT (closes 4840) [Rick Olson]
  • Update inconsistent migrations documentation. 4683 [machomagna@gmail.com]
  • Add ActiveRecord::Errors#to_xml [Jamis Buck]
  • Properly quote index names in migrations (closes 4764) [John Long]
  • Fix the HasManyAssociation#count method so it uses the new ActiveRecord::Base#count syntax, while maintaining backwards compatibility. [Rick Olson]
  • Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions [Rick Olson]
  • Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. [Rick Olson]
  • DRY up association collection reader method generation. [Marcel Molina Jr.]
  • DRY up and tweak style of the validation error object. [Marcel Molina Jr.]
  • Add :case_sensitive option to validates_uniqueness_of (closes 3090) [Rick Olson]
      class Account < ActiveRecord::Base
        validates_uniqueness_of :email, :case_sensitive => false
      end
    
  • Allow multiple association extensions with :extend option (closes 4666) [Josh Susser]
      class Account < ActiveRecord::Base
        has_many :people, :extend => [FindOrCreateByNameExtension, FindRecentExtension]
      end
    
      *1.15.3* (March 12th, 2007)
    
      * Allow a polymorphic :source for has_many :through associations. Closes #7143 [protocool]
    
      * Consistently quote primary key column names.  #7763 [toolmantim]
    
      * Fixtures: fix YAML ordered map support.  #2665 [Manuel Holtgrewe, nfbuckley]
    
      * Fix has_many :through << with custom foreign keys.  #6466, #7153 [naffis, Rich Collins]
    

*1.15.2* (February 5th, 2007)

  • Pass a range in :conditions to use the SQL BETWEEN operator. 6974 [Dan Manges]
      Student.find(:all, :conditions => { :grade => 9..12 })
    
  • Don‘t create instance writer methods for class attributes. [Rick Olson]
  • When dealing with SQLite3, use the table_info pragma helper, so that the bindings can do some translation for when sqlite3 breaks incompatibly between point releases. [Jamis Buck]
  • SQLServer: don‘t choke on strings containing ‘null’. 7083 [Jakob Skjerning]
  • Consistently use LOWER() for uniqueness validations (rather than mixing with UPPER()) so the database can always use a functional index on the lowercased column. 6495 [Si]
  • MySQL: SET SQL_AUTO_IS_NULL=0 so ‘where id is null’ doesn‘t select the last inserted id. 6778 [Jonathan Viney, timc]
  • Fixtures use the table name and connection from set_fixture_class. 7330 [Anthony Eden]
  • SQLServer: quote table name in indexes query. 2928 [keithm@infused.org]

*1.15.1* (January 17th, 2007)

  • Fix nodoc breaking of adapters

*1.15.0* (January 16th, 2007)

  • [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name. 7072 [Jeremy McAnally]
  • change_column accepts :default => nil. Skip column options for primary keys. 6956, 7048 [Dan Manges, Jeremy Kemper]
  • MySQL, PostgreSQL: change_column_default quotes the default value and doesn‘t lose column type information. 3987, 6664 [Jonathan Viney, Manfred Stienstra, altano@bigfoot.com]
  • Oracle: create_table takes a :sequence_name option to override the ‘tablename_seq’ default. 7000 [Michael Schoen]
  • MySQL: retain SSL settings on reconnect. 6976 [randyv2]
  • SQLServer: handle [quoted] table names. 6635 [rrich]
  • acts_as_nested_set works with single-table inheritance. 6030 [Josh Susser]
  • PostgreSQL, Oracle: correctly perform eager finds with :limit and :order. 4668, 7021 [eventualbuddha, Michael Schoen]
  • Fix the Oracle adapter for serialized attributes stored in CLOBs. Closes 6825 [mschoen, tdfowler]
  • [DOCS] Apply more documentation for ActiveRecord Reflection. Closes 4055 [Robby Russell]
  • [DOCS] Document :allow_nil option of validate_uniqueness_of. Closes 3143 [Caio Chassot]
  • Bring the sybase adapter up to scratch for 1.2 release. [jsheets]
  • Oracle: fix connection reset failure. 6846 [leonlleslie]
  • Subclass instantiation doesn‘t try to explicitly require the corresponding subclass. 6840 [leei, Jeremy Kemper]
  • fix faulty inheritance tests and that eager loading grabs the wrong inheritance column when the class of your association is an STI subclass. Closes 6859 [protocool]
  • find supports :lock with :include. Check whether your database allows SELECT … FOR UPDATE with outer joins before using. 6764 [vitaly, Jeremy Kemper]
  • Support nil and Array in :conditions => { attr => value } hashes. 6548 [Assaf, Jeremy Kemper]
      find(:all, :conditions => { :topic_id => [1, 2, 3], :last_read => nil }
    
  • Quote ActiveSupport::Multibyte::Chars. 6653 [Julian Tarkhanov]
  • MySQL: detect when a NOT NULL column without a default value is misreported as default ’’. Can‘t detect for string, text, and binary columns since ’’ is a legitimate default. 6156 [simon@redhillconsulting.com.au, obrie, Jonathan Viney, Jeremy Kemper]
  • validates_numericality_of uses \A \Z to ensure the entire string matches rather than ^ $ which may match one valid line of a multiline string. 5716 [Andreas Schwarz]
  • Oracle: automatically detect the primary key. 6594 [vesaria, Michael Schoen]
  • Oracle: to increase performance, prefetch 100 rows and enable similar cursor sharing. Both are configurable in database.yml. 6607 [philbogle@gmail.com, ray.fortna@jobster.com, Michael Schoen]
  • Firebird: decimal/numeric support. 6408 [macrnic]
  • Find with :include respects scoped :order. 5850
  • Dynamically generate reader methods for serialized attributes. 6362 [Stefan Kaes]
  • Deprecation: object transactions warning. [Jeremy Kemper]
  • has_one :dependent => :nullify ignores nil associates. 6528 [janovetz, Jeremy Kemper]
  • Oracle: resolve test failures, use prefetched primary key for inserts, check for null defaults, fix limited id selection for eager loading. Factor out some common methods from all adapters. 6515 [Michael Schoen]
  • Make add_column use the options hash with the Sqlite Adapter. Closes 6464 [obrie]
  • Document other options available to migration‘s add_column. 6419 [grg]
  • MySQL: all_hashes compatibility with old MysqlRes class. 6429, 6601 [Jeremy Kemper]
  • Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes 5783. [Jonathan Viney]
  • fix select_limited_ids_list issues in postgresql, retain current behavior in other adapters [Rick Olson]
  • Restore eager condition interpolation, document it‘s differences [Rick Olson]
  • Don‘t rollback in teardown unless a transaction was started. Don‘t start a transaction in create_fixtures if a transaction is started. 6282 [Jacob Fugal, Jeremy Kemper]
  • Add delete support to has_many :through associations. Closes 6049 [Martin Landers]
  • Reverted old select_limited_ids_list postgresql fix that caused issues in mysql. Closes 5851 [Rick Olson]
  • Removes the ability for eager loaded conditions to be interpolated, since there is no model instance to use as a context for interpolation. 5553 [turnip@turnipspatch.com]
  • Added timeout option to SQLite3 configurations to deal more gracefully with SQLite3::BusyException, now the connection can instead retry for x seconds to see if the db clears up before throwing that exception 6126 [wreese@gmail.com]
  • Added update_attributes! which uses save! to raise an exception if a validation error prevents saving 6192 [jonathan]
  • Deprecated add_on_boundary_breaking (use validates_length_of instead) 6292 [Bob Silva]
  • The has_many create method works with polymorphic associations. 6361 [Dan Peterson]
  • MySQL: introduce Mysql::Result#all_hashes to support further optimization. 5581 [Stefan Kaes]
  • save! shouldn‘t validate twice. 6324 [maiha, Bob Silva]
  • Association collections have an _ids reader method to match the existing writer for collection_select convenience (e.g. employee.task_ids). The writer method skips blank ids so you can safely do @employee.task_ids = params[:tasks] without checking every time for an empty list or blank values. 1887, 5780 [Michael Schuerig]
  • Add an attribute reader method for ActiveRecord::Base.observers [Rick Olson]
  • Deprecation: count class method should be called with an options hash rather than two args for conditions and joins. 6287 [Bob Silva]
  • has_one associations with a nil target may be safely marshaled. 6279 [norbauer, Jeremy Kemper]
  • Duplicate the hash provided to AR::Base#to_xml to prevent unexpected side effects [Michael Koziarski]
  • Add a :namespace option to AR::Base#to_xml [Michael Koziarski]
  • Deprecation tests. Remove warnings for dynamic finders and for the foo_count method if it‘s also an attribute. [Jeremy Kemper]
  • Mock Time.now for more accurate Touch mixin tests. 6213 [Dan Peterson]
  • Improve yaml fixtures error reporting. 6205 [Bruce Williams]
  • Rename AR::Base#quote so people can use that name in their models. 3628 [Michael Koziarski]
  • Add deprecation warning for inferred foreign key. 6029 [Josh Susser]
  • Fixed the Ruby/MySQL adapter we ship with Active Record to work with the new authentication handshake that was introduced in MySQL 4.1, along with the other protocol changes made at that time 5723 [jimw@mysql.com]
  • Deprecation: use :dependent => :delete_all rather than :exclusively_dependent => true. 6024 [Josh Susser]
  • Optimistic locking: gracefully handle nil versions, treat as zero. 5908 [Tom Ward]
  • to_xml: the :methods option works on arrays of records. 5845 [Josh Starcher]
  • has_many :through conditions are sanitized by the associating class. 5971 [martin.emde@gmail.com]
  • Fix spurious newlines and spaces in AR::Base#to_xml output [Jamis Buck]
  • has_one supports the :dependent => :delete option which skips the typical callback chain and deletes the associated object directly from the database. 5927 [Chris Mear, Jonathan Viney]
  • Nested subclasses are not prefixed with the parent class’ table_name since they should always use the base class’ table_name. 5911 [Jonathan Viney]
  • SQLServer: work around bug where some unambiguous date formats are not correctly identified if the session language is set to german. 5894 [Tom Ward, kruth@bfpi]
  • Clashing type columns due to a sloppy join shouldn‘t wreck single-table inheritance. 5838 [Kevin Clark]
  • Fixtures: correct escaping of \n and \r. 5859 [evgeny.zislis@gmail.com]
  • Migrations: gracefully handle missing migration files. 5857 [eli.gordon@gmail.com]
  • MySQL: update test schema for MySQL 5 strict mode. 5861 [Tom Ward]
  • to_xml: correct naming of included associations. 5831 [Josh Starcher]
  • Pushing a record onto a has_many :through sets the association‘s foreign key to the associate‘s primary key and adds it to the correct association. 5815, 5829 [Josh Susser]
  • Add records to has_many :through using <<, push, and concat by creating the association record. Raise if base or associate are new records since both ids are required to create the association. build raises since you can‘t associate an unsaved record. create! takes an attributes hash and creates the associated record and its association in a transaction. [Jeremy Kemper]
      # Create a tagging to associate the post and tag.
      post.tags << Tag.find_by_name('old')
      post.tags.create! :name => 'general'
    
      # Would have been:
      post.taggings.create!(:tag => Tag.find_by_name('finally')
      transaction do
        post.taggings.create!(:tag => Tag.create!(:name => 'general'))
      end
    
  • Cache nil results for :included has_one associations also. 5787 [Michael Schoen]
  • Fixed a bug which would cause .save to fail after trying to access a empty has_one association on a unsaved record. [Tobias Lütke]
  • Nested classes are given table names prefixed by the singular form of the parent‘s table name. [Jeremy Kemper]
      Example: Invoice::Lineitem is given table name invoice_lineitems
    
  • Migrations: uniquely name multicolumn indexes so you don‘t have to. [Jeremy Kemper]
      # people_active_last_name_index, people_active_deactivated_at_index
      add_index    :people, [:active, :last_name]
      add_index    :people, [:active, :deactivated_at]
      remove_index :people, [:active, :last_name]
      remove_index :people, [:active, :deactivated_at]
    

    WARNING: backward-incompatibility. Multicolumn indexes created before this revision were named using the first column name only. Now they‘re uniquely named using all indexed columns.

    To remove an old multicolumn index, remove_index :table_name, :first_column

  • Fix for deep includes on the same association. [richcollins@gmail.com]
  • Tweak fixtures so they don‘t try to use a non-ActiveRecord class. [Kevin Clark]
  • Remove ActiveRecord::Base.reset since Dispatcher doesn‘t use it anymore. [Rick Olson]
  • PostgreSQL: autodetected sequences work correctly with multiple schemas. Rely on the schema search_path instead of explicitly qualifying the sequence name with its schema. 5280 [guy.naor@famundo.com]
  • Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
  • Cache nil results for has_one associations so multiple calls don‘t call the database. Closes 5757. [Michael Schoen]
  • Don‘t save has_one associations unnecessarily. 5735 [Jonathan Viney]
  • Refactor ActiveRecord::Base.reset_subclasses to reset, and add global observer resetting. [Rick Olson]
  • Formally deprecate the deprecated finders. [Michael Koziarski]
  • Formally deprecate rich associations. [Michael Koziarski]
  • Fixed that default timezones for new / initialize should uphold utc setting 5709 [daniluk@yahoo.com]
  • Fix announcement of very long migration names. 5722 [blake@near-time.com]
  • The exists? class method should treat a string argument as an id rather than as conditions. 5698 [jeremy@planetargon.com]
  • Fixed to_xml with :include misbehaviors when invoked on array of model instances 5690 [alexkwolfe@gmail.com]
  • Added support for conditions on Base.exists? 5689 [Josh Peek]. Examples:
      assert (Topic.exists?(:author_name => "David"))
            assert (Topic.exists?(:author_name => "Mary", :approved => true))
            assert (Topic.exists?(["parent_id = ?", 1]))
    
  • Schema dumper quotes date :default values. [Dave Thomas]
  • Calculate sum with SQL, not Enumerable on HasManyThrough Associations. [Dan Peterson]
  • Factor the attribute#{suffix} methods out of method_missing for easier extension. [Jeremy Kemper]
  • Patch sql injection vulnerability when using integer or float columns. [Jamis Buck]
  • Allow count through a has_many association to accept :include. [Dan Peterson]
  • create_table rdoc: suggest :id => false for habtm join tables. [Zed Shaw]
  • PostgreSQL: return array fields as strings. 4664 [Robby Russell]
  • SQLServer: added tests to ensure all database statements are closed, refactored identity_insert management code to use blocks, removed update/delete rowcount code out of execute and into update/delete, changed insert to go through execute method, removed unused quoting methods, disabled pessimistic locking tests as feature is currently unsupported, fixed RakeFile to load sqlserver specific tests whether running in ado or odbc mode, fixed support for recently added decimal types, added support for limits on integer types. 5670 [Tom Ward]
  • SQLServer: fix db:schema:dump case-sensitivity. 4684 [Will Rogers]
  • Oracle: BigDecimal support. 5667 [Michael Schoen]
  • Numeric and decimal columns map to BigDecimal instead of Float. Those with scale 0 map to Integer. 5454 [robbat2@gentoo.org, work@ashleymoran.me.uk]
  • Firebird migrations support. 5337 [Ken Kunz <kennethkunz@gmail.com>]
  • PostgreSQL: create/drop as postgres user. 4790 [mail@matthewpainter.co.uk, mlaster@metavillage.com]
  • PostgreSQL: correctly quote the ’ in pk_and_sequence_for. 5462 [tietew@tietew.net]
  • PostgreSQL: correctly quote microseconds in timestamps. 5641 [rick@rickbradley.com]
  • Clearer has_one/belongs_to model names (account has_one :user). 5632 [matt@mattmargolis.net]
  • Oracle: use nonblocking queries if allow_concurrency is set, fix pessimistic locking, don‘t guess date vs. time by default (set OracleAdapter.emulate_dates = true for the old behavior), adapter cleanup. 5635 [Michael Schoen]
  • Fixed a few Oracle issues: Allows Oracle‘s odd date handling to still work consistently within to_xml, Passes test that hardcode insert statement by dropping the :id column, Updated RUNNING_UNIT_TESTS with Oracle instructions, Corrects method signature for exec 5294 [Michael Schoen]
  • Added :group to available options for finds done on associations 5516 [mike@michaeldewey.org]
  • Observers also watch subclasses created after they are declared. 5535 [daniels@pronto.com.au]
  • Removed deprecated timestamps_gmt class methods. [Jeremy Kemper]
  • rake build_mysql_database grants permissions to rails@localhost. 5501 [brianegge@yahoo.com]
  • PostgreSQL: support microsecond time resolution. 5492 [alex@msgpad.com]
  • Add AssociationCollection#sum since the method_missing invokation has been shadowed by Enumerable#sum.
  • Added find_or_initialize_by_X which works like find_or_create_by_X but doesn‘t save the newly instantiated record. [Sam Stephenson]
  • Row locking. Provide a locking clause with the :lock finder option or true for the default "FOR UPDATE". Use the lock! method to obtain a row lock on a single record (reloads the record with :lock => true). [Shugo Maeda]
      # Obtain an exclusive lock on person 1 so we can safely increment visits.
      Person.transaction do
        # select * from people where id=1 for update
        person = Person.find(1, :lock => true)
        person.visits += 1
        person.save!
      end
    
  • PostgreSQL: introduce allow_concurrency option which determines whether to use blocking or asynchronous execute. Adapters with blocking execute will deadlock Ruby threads. The default value is ActiveRecord::Base.allow_concurrency. [Jeremy Kemper]
  • Use a per-thread (rather than global) transaction mutex so you may execute concurrent transactions on separate connections. [Jeremy Kemper]
  • Change AR::Base#to_param to return a String instead of a Fixnum. Closes 5320. [Nicholas Seckar]
  • Use explicit delegation instead of method aliasing fo