CHANGELOG 295.1 KB
Newer Older
1 2
*Edge*

3 4 5 6 7
* Add .lock finder method [Pratik Naik]

  User.lock.where(:name => 'lifo').to_a

  old_items = Item.where("age > 100")
P
Pratik Naik 已提交
8
  old_items.lock.each {|i| .. }
9

10 11 12 13 14
* Add Model.from and association_collection#from finder methods [Pratik Naik]

  user = User.scoped
  user.select('*').from('users, items')

P
Pratik Naik 已提交
15 16 17 18 19
* Add relation.destroy_all [Pratik Naik]

  old_items = Item.where("age > 100")
  old_items.destroy_all

P
Pratik Naik 已提交
20 21 22 23 24 25
* Add relation.exists? [Pratik Naik]

  red_items = Item.where(:colours => 'red')
  red_items.exists?
  red_items.exists?(1)

P
Pratik Naik 已提交
26 27 28 29 30 31
* Add find(ids) to relations. [Pratik Naik]

  old_users = User.order("age DESC")
  old_users.find(1)
  old_users.find(1, 2, 3)

32 33 34 35 36 37 38 39 40 41
* Add new finder methods to association collection. [Pratik Naik]

  class User < ActiveRecord::Base
    has_many :items
  end

  user = User.first
  user.items.where(:items => {:colour => 'red'})
  user.items.select('items.id')

42 43 44 45 46 47 48 49
* Add relation.reload to force reloading the records. [Pratik Naik]

  topics = Topic.scoped
  topics.to_a  # force load
  topics.first # returns a cached record
  topics.reload
  topics.first # Fetches a new record from the database

P
Pratik Naik 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
* Rename Model.conditions and relation.conditions to .where. [Pratik Naik]

  Before :
    User.conditions(:name => 'lifo')
    User.select('id').conditions(["age > ?", 21])

  Now :
    User.where(:name => 'lifo')
    User.select('id').where(["age > ?", 21])

* Add Model.select/group/order/limit/joins/conditions/preload/eager_load class methods returning a lazy relation. [Pratik Naik]

  Examples :

    posts = Post.select('id).order('name') # Returns a lazy relation
    posts.each {|p| puts p.id } # Fires "select id from posts order by name"

* Model.scoped now returns a relation if invoked without any arguments. [Pratik Naik]

  Example :

    posts = Post.scoped
    posts.size # Fires "select count(*) from  posts" and returns the count
    posts.each {|p| puts p.name } # Fires "select * from posts" and loads post objects

75 76 77 78 79 80 81
* Association inverses for belongs_to, has_one, and has_many. Optimization to reduce database queries.  #3533 [Murray Steele]

    # post.comments sets each comment's post without needing to :include
    class Post < ActiveRecord::Base
      has_many :comments, :inverse_of => :post
    end

82 83
* MySQL: add_ and change_column support positioning.  #3286 [Ben Marini]

84
* Reset your Active Record counter caches with the reset_counter_cache class method.  #1211 [Mike Breen, Gabe da Silveira]
85

P
Pratik Naik 已提交
86 87
* Remove support for SQLite 2. Please upgrade to SQLite 3+ or install the plugin from git://github.com/rails/sqlite2_adapter.git [Pratik Naik]

88 89
* PostgreSQL: XML datatype support.  #1874 [Leonardo Borges]

90 91
* quoted_date converts time-like objects to ActiveRecord::Base.default_timezone before serialization. This allows you to use Time.now in find conditions and have it correctly be serialized as the current time in UTC when default_timezone == :utc. #2946 [Geoff Buesing]

92 93
* SQLite: drop support for 'dbfile' option in favor of 'database.'  #2363 [Paul Hinze, Jeremy Kemper]

94 95 96 97
* 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'

98 99
* Implement #many? for NamedScope and AssociationCollection using #size. #1500 [Chris Kampmeier]

100 101 102
* 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]
103 104


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

107
* Added ActiveRecord::Base.find_each and ActiveRecord::Base.find_in_batches for batch processing [DHH/Jamis Buck]
108

109 110
* Added that ActiveRecord::Base.exists? can be called with no arguments #1817 [Scott Taylor]

111 112 113 114 115 116 117 118 119
* 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

120 121 122 123
* 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.

124 125
* Support nested transactions using database savepoints.  #383 [Jonathan Viney, Hongli Lai]

126 127
* Added dynamic scopes ala dynamic finders #1648 [Yaroslav Markin]

128 129
* Fixed that ActiveRecord::Base#new_record? should return false (not nil) for existing records #1219 [Yaroslav Markin]

J
Jeremy Kemper 已提交
130 131
* I18n the word separator for error messages. Introduces the activerecord.errors.format.separator translation key.  #1294 [Akira Matsuda]

132
* Add :having as a key to find and the relevant associations.  [Emilio Tagua]
133

134 135 136 137 138 139 140 141 142 143 144 145 146 147
* 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 })


D
David Heinemeier Hansson 已提交
148
*2.2.1 [RC2] (November 14th, 2008)*
149

150 151
* Ensure indices don't flip order in schema.rb #1266 [Jordi Bunster]

152 153 154
* Fixed that serialized strings should never be type-casted (i.e. turning "Yes" to a boolean) #857 [Andreas Korth]


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

* Skip collection ids reader optimization if using :finder_sql [Jeremy Kemper]
158

159
* Add Model#delete instance method, similar to Model.delete class method. #1086 [Hongli Lai (Phusion)]
160

161 162
* MySQL: cope with quirky default values for not-null text columns.  #1043 [Frederick Cheung]

163 164
* Multiparameter attributes skip time zone conversion for time-only columns [#1030 state:resolved] [Geoff Buesing]

165
* Base.skip_time_zone_conversion_for_attributes uses class_inheritable_accessor, so that subclasses don't overwrite Base [#346 state:resolved] [Emilio Tagua]
166

167
* Added find_last_by dynamic finder #762 [Emilio Tagua]
D
David Heinemeier Hansson 已提交
168

169
* Internal API: configurable association options and build_association method for reflections so plugins may extend and override.  #985 [Hongli Lai (Phusion)]
170

171
* Changed benchmarks to be reported in milliseconds [David Heinemeier Hansson]
172

173 174
* Connection pooling.  #936 [Nick Sieger]

J
Jeremy Kemper 已提交
175 176
* Merge scoped :joins together instead of overwriting them. May expose scoping bugs in your code!  #501 [Andrew White]

177 178
* 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]

179 180
* Transactional migrations for databases which support them.  #834 [divoxx, Adam Wiggins, Tarmo Tänav]

181 182
* Set config.active_record.timestamped_migrations = false to have migrations with numeric prefix instead of UTC timestamp. #446. [Andrew Stone, Nik Wakelin]

183 184
* change_column_default preserves the not-null constraint.  #617 [Tarmo Tänav]

185 186
* Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) [#334]

187 188 189 190 191
* 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+/) }

192 193 194 195 196
* 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' } }

197 198
* Always treat integer :limit as byte length.  #420 [Tarmo Tänav]

199 200
* Partial updates don't update lock_version if nothing changed.  #426 [Daniel Morrison]

201 202
* Fix column collision with named_scope and :joins.  #46 [Duncan Beevers, Mark Catley]

203 204
* db:migrate:down and :up update schema_migrations.  #369 [Michael Raidel, RaceCondition]

J
Jeremy Kemper 已提交
205
* PostgreSQL: support :conditions => [':foo::integer', { :foo => 1 }] without treating the ::integer typecast as a bind variable.  [Tarmo Tänav]
J
Jeremy Kemper 已提交
206

207 208
* MySQL: rename_column preserves column defaults.  #466 [Diego Algorta]

209 210
* Add :from option to calculations.  #397 [Ben Munat]

211 212
* Add :validate option to associations to enable/disable the automatic validation of associated models. Resolves #301. [Jan De Poorter]

213 214
* PostgreSQL: use 'INSERT ... RETURNING id' for 8.2 and later.  [Jeremy Kemper]

215 216 217
* Added SQL escaping for :limit and :offset in MySQL [Jonathan Wiess]


218
*2.1.0 (May 31st, 2008)*
219

220
* Add ActiveRecord::Base.sti_name that checks ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. [Rick Olson]
221

222 223
* Add first/last methods to associations/named_scope. Resolved #226. [Ryan Bates]

224 225 226
* 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]
227

228 229
* Ensure hm:t preloading honours reflection options. Resolves #137. [Frederick Cheung]

230 231
* Added protection against duplicate migration names (Aslak Hellesøy) [#112]

232 233
* 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]

G
gbuesing 已提交
234 235
* 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]

236 237 238 239
* Added change_table for migrations (Jeff Dean) [#71]. Example:

    change_table :videos do |t|
      t.timestamps                          # adds created_at, updated_at
240
      t.belongs_to :goat                    # adds goat_id integer
241 242 243 244
      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

D
David Heinemeier Hansson 已提交
245 246
* Fixed has_many :through .create with no parameters caused a "can't dup NilClass" error (Steven Soroka) [#85]

247 248
* Added block-setting of attributes for Base.create like Base.new already has (Adam Meehan) [#39]

249 250
* Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [#67]

251 252
* Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] [#26]

253
* Added that the MySQL adapter should map integer to either smallint, int, or bigint depending on the :limit just like PostgreSQL [David Heinemeier Hansson]
254

255
* Change validates_uniqueness_of :case_sensitive option default back to true (from [9160]).  Love your database columns, don't LOWER them.  [Rick Olson]
256

257
* Add support for interleaving migrations by storing which migrations have run in the new schema_migrations table. Closes #11493 [Jordi Bunster]
258

259
* ActiveRecord::Base#sum defaults to 0 if no rows are returned.  Closes #11550 [Kamal Fariz Mahyuddin]
260

261
* Ensure that respond_to? considers dynamic finder methods. Closes #11538. [James Mead]
262

263
* Ensure that save on parent object fails for invalid has_one association. Closes #10518. [Pratik Naik]
264

265
* Remove duplicate code from associations. [Pratik Naik]
266

267
* Refactor HasManyThroughAssociation to inherit from HasManyAssociation. Association callbacks and <association>_ids= now work with hm:t. #11516 [Ruy Asan]
268

269
* Ensure HABTM#create and HABTM#build do not load entire association. [Pratik Naik]
270

P
Pratik Naik 已提交
271 272
* Improve documentation. [Xavier Noria, Jack Danger Canty, leethal]

273
* Tweak ActiveRecord::Base#to_json to include a root value in the returned hash: {"post": {"title": ...}} [Rick Olson]
274 275 276 277 278

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

279 280
* Add efficient #include? to AssociationCollection (for has_many/has_many :through/habtm).  [stopdropandrew]

281
* PostgreSQL: create_ and drop_database support.  #9042 [ez, pedz, Nick Sieger]
282

283
* Ensure that validates_uniqueness_of works with with_scope. Closes #9235. [Nik Wakelin, cavalle]
284

285 286
* Partial updates include only unsaved attributes. Off by default; set YourClass.partial_updates = true to enable.  [Jeremy Kemper]

287 288
* Removing unnecessary uses_tzinfo helper from tests, given that TZInfo is now bundled [Geoff Buesing]

289 290
* Fixed that validates_size_of :within works in associations #11295, #10019 [cavalle]

291 292
* Track changes to unsaved attributes.  [Jeremy Kemper]

293
* 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]
294

295
* Fixed that has_many :through would ignore the hash conditions #11447 [Emilio Tagua]
296

297 298
* Fix issue where the :uniq option of a has_many :through association is ignored when find(:all) is called.  Closes #9407 [cavalle]

299 300
* Fix duplicate table alias error when including an association with a has_many :through association on the same join table.  Closes #7310 [cavalle]

301
* More efficient association preloading code that compacts a through_records array in a central location.  Closes #11427 [Jack Danger Canty]
302

303
* Improve documentation. [Ryan Bigg, Jan De Poorter, Cheah Chu Yeow, Xavier Shay, Jack Danger Canty, Emilio Tagua, Xavier Noria,  Sunny Ripert]
P
Pratik Naik 已提交
304

305
* Fixed that ActiveRecord#Base.find_or_create/initialize would not honor attr_protected/accessible when used with a hash #11422 [Emilio Tagua]
306

307
* Added ActiveRecord#Base.all/first/last as aliases for find(:all/:first/:last) #11413 [nkallen, Chris O'Sullivan]
308

309 310 311
* Merge the has_finder gem, renamed as 'named_scope'.  #11404 [nkallen]

  class Article < ActiveRecord::Base
312 313
    named_scope :published, :conditions => {:published => true}
    named_scope :popular, :conditions => ...
314 315 316 317 318 319 320 321 322
  end

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

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

323
* Add has_one :through support.  #4756 [Chris O'Sullivan]
324

325
* Migrations: create_table supports primary_key_prefix_type.  #10314 [student, Chris O'Sullivan]
326

327 328
* Added logging for dependency load errors with fixtures #11056 [stuthulhu]

329 330
* Time zone aware attributes use Time#in_time_zone [Geoff Buesing]

331
* Fixed that scoped joins would not always be respected #6821 [Theory/Jack Danger Canty]
332

333 334
* Ensure that ActiveRecord::Calculations disambiguates field names with the table name.  #11027 [cavalle]

335 336
* Added add/remove_timestamps to the schema statements for adding the created_at/updated_at columns on existing tables #11129 [jramirez]

337
* Added ActiveRecord::Base.find(:last) #11338 [Emilio Tagua]
338

339 340
* test_native_types expects DateTime.local_offset instead of DateTime.now.offset; fixes test breakage due to dst transition [Geoff Buesing]

341
* Add :readonly option to HasManyThrough associations. #11156 [Emilio Tagua]
342

343 344
* Improve performance on :include/:conditions/:limit queries by selectively joining in the pre-query.  #9560 [dasil003]

345 346
* Perf fix: Avoid the use of named block arguments.  Closes #11109 [adymo]

347 348
* PostgreSQL: support server versions 7.4 through 8.0 and the ruby-pg driver.  #11127 [jdavis]

349 350
* Ensure association preloading doesn't break when an association returns nil. ##11145 [GMFlash]

351 352
* Make dynamic finders respect the :include on HasManyThrough associations.  #10998. [cpytel]

353 354
* 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]

355 356
* Refactor ConnectionAdapters::Column.new_time: leverage DateTime failover behavior of Time#time_with_datetime_fallback [Geoff Buesing]

357 358
* Improve associations performance by using symbol callbacks instead of string callbacks. #11108 [adymo]

359 360
* Optimise the BigDecimal conversion code.  #11110 [adymo]

361
* Introduce the :readonly option to all associations. Records from the association cannot be saved.  #11084 [Emilio Tagua]
362

363 364
* Multiparameter attributes for time columns fail over to DateTime when out of range of Time [Geoff Buesing]

365 366
* Base#instantiate_time_object uses Time.zone.local() [Geoff Buesing]

367 368
* Add timezone-aware attribute readers and writers. #10982 [Geoff Buesing]

369
* Instantiating time objects in multiparameter attributes uses Time.zone if available.  #10982 [Rick Olson]
370

371
* Add note about how ActiveRecord::Observer classes are initialized in a Rails app. #10980 [Xavier Noria]
372

373 374
* MySQL: omit text/blob defaults from the schema instead of using an empty string.  #10963 [mdeiters]

375 376
* belongs_to supports :dependent => :destroy and :delete.  #10592 [Jonathan Viney]

377
* Introduce preload query strategy for eager :includes.  #9640 [Frederick Cheung, Aliaksey Kandratsenka, codafoo]
378

379 380
* Support aggregations in finder conditions.  #10572 [Ryan Kinderman]

381 382
* Organize and clean up the Active Record test suite.  #10742 [John Barnette]

383 384
* Ensure that modifying has_and_belongs_to_many actions clear the query cache.  Closes #10840 [john.andrews]

385 386
* Fix issue where Table#references doesn't pass a :null option to a *_type attribute for polymorphic associations.  Closes #10753 [railsjitsu]

387 388
* Fixtures: removed support for the ancient pre-YAML file format.  #10736 [John Barnette]

389 390
* More thoroughly quote table names.  #10698 [dimdenis, lotswholetime, Jeremy Kemper]

391 392
* 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]

393
* Added ActiveRecord::Base.cache_key to make it easier to cache Active Records in combination with the new ActiveSupport::Cache::* libraries [David Heinemeier Hansson]
394

395 396
* Make sure CSV fixtures are compatible with ruby 1.9's new csv implementation. [JEG2]

397 398
* Added by parameter to increment, decrement, and their bang varieties so you can do player1.increment!(:points, 5) #10542 [Sam]

399
* Optimize ActiveRecord::Base#exists? to use #select_all instead of #find.  Closes #10605 [jamesh, Frederick Cheung, protocool]
400

401 402
* Don't unnecessarily load has_many associations in after_update callbacks.  Closes #6822 [stopdropandrew, canadaduane]

403 404
* Eager belongs_to :include infers the foreign key from the association name rather than the class name.  #10517 [Jonathan Viney]

405 406
* SQLite: fix rename_ and remove_column for columns with unique indexes.  #10576 [Brandon Keepers]

407
* Ruby 1.9 compatibility.  #10655 [Jeremy Kemper, Dirkjan Bussink]
408 409


410
*2.0.2* (December 16th, 2007)
411

412
* Ensure optimistic locking handles nil #lock_version values properly.  Closes #10510 [Rick Olson]
413

414 415
* Make the Fixtures Test::Unit enhancements more supporting for double-loaded test cases.  Closes #10379 [brynary]

416
* Fix that validates_acceptance_of still works for non-existent tables (useful for bootstrapping new databases).  Closes #10474 [Josh Susser]
417

418 419
* Ensure that the :uniq option for has_many :through associations retains the order.  #10463 [remvee]

420 421
* Base.exists? doesn't rescue exceptions to avoid hiding SQL errors.  #10458 [Michael Klishin]

422
* Documentation: Active Record exceptions, destroy_all and delete_all.  #10444, #10447 [Michael Klishin]
423 424


425 426
*2.0.1* (December 7th, 2007)

427
* Removed query cache rescue as it could cause code to be run twice (closes #10408) [David Heinemeier Hansson]
428 429


430
*2.0.0* (December 6th, 2007)
431

432 433
* 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]

434
* 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]
435

J
Jeremy Kemper 已提交
436 437
* Fixed that the truncation of strings longer than 50 chars should use inspect
so newlines etc are escaped #10385 [Norbert Crombach]
438

439
* Fixed that habtm associations should be able to set :select as part of their definition and have that honored [David Heinemeier Hansson]
440

441 442
* Document how the :include option can be used in Calculations::calculate.  Closes #7446 [adamwiggins, ultimoamore]

443 444
* Fix typo in documentation for polymorphic associations w/STI. Closes #7461 [johnjosephbachir]

445 446
* 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]

447 448
* More complete documentation for find_by_sql. Closes #7912 [fearoffish]

449
* Added ActiveRecord::Base#becomes to turn a record into one of another class (mostly relevant for STIs) [David Heinemeier Hansson]. Example:
450 451 452

    render :partial => @client.becomes(Company) # renders companies/company instead of clients/client

J
Jeremy Kemper 已提交
453
* Fixed that to_xml should not automatically pass :procs to associations included with :include #10162 [Cheah Chu Yeow]
454

455 456
* Fix documentation typo introduced in [8250]. Closes #10339 [Henrik N]

457 458
* Foxy fixtures: support single-table inheritance.  #10234 [tom]

459 460
* Foxy fixtures: allow mixed usage to make migration easier and more attractive.  #10004 [lotswholetime]

461 462
* Make the record_timestamps class-inheritable so it can be set per model.  #10004 [tmacedo]

463 464
* Allow validates_acceptance_of to use a real attribute instead of only virtual (so you can record that the acceptance occured) #7457 [ambethia]

465 466
* DateTimes use Ruby's default calendar reform setting. #10201 [Geoff Buesing]

467 468
* Dynamic finders on association collections respect association :order and :limit.  #10211, #10227 [Patrick Joyce, Rick Olson, Jack Danger Canty]

469
* Add 'foxy' support for fixtures of polymorphic associations. #10183 [John Barnette, David Lowenfels]
470

471 472
* validates_inclusion_of and validates_exclusion_of allow formatted :message strings.  #8132 [devrieda, Mike Naberezny]

473 474
* attr_readonly behaves well with optimistic locking.  #10188 [Nick Bugajski]

475
* Base#to_xml supports the nil="true" attribute like Hash#to_xml.  #8268 [Jonathan del Strother]
476

477
* Change plings to the more conventional quotes in the documentation. Closes #10104 [Jack Danger Canty]
478

479
* Fix HasManyThrough Association so it uses :conditions on the HasMany Association.  Closes #9729 [Jack Danger Canty]
480

481 482
* Ensure that column names are quoted.  Closes #10134 [wesley.moxam]

483
* Smattering of grammatical fixes to documentation. Closes #10083 [Bob Silva]
484

485
* Enhance explanation with more examples for attr_accessible macro. Closes #8095 [fearoffish, Marcel Molina Jr.]
486

J
Jeremy Kemper 已提交
487
* Update association/method mapping table to refected latest collection methods for has_many :through. Closes #8772 [Pratik Naik]
488

489
* Explain semantics of having several different AR instances in a transaction block. Closes #9036 [jacobat, Marcel Molina Jr.]
490

491
* Update Schema documentation to use updated sexy migration notation. Closes #10086 [Sam Granieri]
492

493
* Make fixtures work with the new test subclasses. [Tarmo Tänav, Michael Koziarski]
494

495 496 497 498 499 500 501
* 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')

J
Jeremy Kemper 已提交
502
* Associations: speedup duplicate record check.  #10011 [Pratik Naik]
503

504
* Make sure that << works on has_many associations on unsaved records.  Closes #9989 [Josh Susser]
505

506 507
* Allow association redefinition in subclasses.  #9346 [wildchild]

508 509
* Fix has_many :through delete with custom foreign keys.  #6466 [naffis]

510 511 512 513 514 515 516
* Foxy fixtures, from rathole (http://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
517
  Enabled for fixtures that correspond to a model class and don't specify a primary key value.  #9981 [John Barnette]
518

519 520
* Add docs explaining how to protect all attributes using attr_accessible with no arguments. Closes #9631 [boone, rmm5t]

J
Jeremy Kemper 已提交
521
* Update add_index documentation to use new options api. Closes #9787 [Kamal Fariz Mahyuddin]
522

523 524
* Allow find on a has_many association defined with :finder_sql to accept id arguments as strings like regular find does. Closes #9916 [krishna]

525 526
* Use VALID_FIND_OPTIONS when resolving :find scoping rather than hard coding the list of valid find options. Closes #9443 [sur]

527
* Limited eager loading no longer ignores scoped :order. Closes #9561 [Jack Danger Canty, Josh Peek]
528

529 530
* 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]

531 532
* Assigning nil to a composed_of aggregate also sets its immediate value to nil.  #9843 [Chris Cruft]

533 534 535 536
* Ensure that mysql quotes table names with database names correctly.  Closes #9911 [crayz]

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

M
Michael Koziarski 已提交
537 538 539
* Complete the assimilation of Sexy Migrations from ErrFree [Chris Wanstrath, PJ Hyett]
	http://errtheblog.com/post/2381

540
* Qualified column names work in hash conditions, like :conditions => { 'comments.created_at' => ... }.  #9733 [Jack Danger Canty]
541

542 543
* 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]

J
Jeremy Kemper 已提交
544
* Refactor association create and build so before & after callbacks behave consistently.  #8854 [Pratik Naik, mortent]
545

546 547
* Quote table names. Defaults to column quoting.  #4593 [Justin Lynn, gwcoffey, eadz, Dmitry V. Sabanin, Jeremy Kemper]

J
Jeremy Kemper 已提交
548
* Alias association #build to #new so it behaves predictably.  #8787 [Pratik Naik]
549

550
* Add notes to documentation regarding attr_readonly behavior with counter caches and polymorphic associations.  Closes #9835 [saimonmoore, Rick Olson]
551

552 553
* Observers can observe model names as symbols properly now.  Closes #9869  [queso]

554
* find_and_(initialize|create)_by methods can now properly initialize protected attributes [Tobias Lütke]
555

556 557
* belongs_to infers the foreign key from the association name instead of from the class name.  [Jeremy Kemper]

558 559
* PostgreSQL: support multiline default values.  #7533 [Carl Lerche, aguynamedryan, Rein Henrichs, Tarmo Tänav]

560 561
* MySQL: fix change_column on not-null columns that don't accept dfeault values of ''.  #6663 [Jonathan Viney, Tarmo Tänav]

562 563
* 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]
564

565
* Warn about protected attribute assigments in development and test environments when mass-assigning to an attr_protected attribute.  #9802 [Henrik N]
566

567
* Speedup database date/time parsing.  [Jeremy Kemper, Tarmo Tänav]
J
Jeremy Kemper 已提交
568

J
Jeremy Kemper 已提交
569
* Fix calling .clear on a has_many :dependent=>:delete_all association. [Tarmo Tänav]
570

J
Jeremy Kemper 已提交
571
* Allow change_column to set NOT NULL in the PostgreSQL adapter [Tarmo Tänav]
572

573
* Fix that ActiveRecord would create attribute methods and override custom attribute getters if the method is also defined in Kernel.methods. [Rick Olson]
574

575
* 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]
576

577 578 579
* 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]


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

582
* Add attr_readonly to specify columns that are skipped during a normal ActiveRecord #save operation. Closes #6896 [Dan Manges]
583 584 585 586 587 588 589 590 591 592

  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

593
* Make size for has_many :through use counter cache if it exists.  Closes #9734 [Xavier Shay]
594

595 596
* Remove DB2 adapter since IBM chooses to maintain their own adapter instead.  [Jeremy Kemper]

597 598
* Extract Oracle, SQLServer, and Sybase adapters into gems.  [Jeremy Kemper]

J
Jeremy Kemper 已提交
599
* Added fixture caching that'll speed up a normal fixture-powered test suite between 50% and 100% #9682 [Frederick Cheung]
600

601 602
* Correctly quote id list for limited eager loading.  #7482 [tmacedo]

603 604
* Fixed that using version-targetted migrates would fail on loggers other than the default one #7430 [valeksenko]

605 606
* Fixed rename_column for SQLite when using symbols for the column names #8616 [drodriguez]

J
Jeremy Kemper 已提交
607
* Added the possibility of using symbols in addition to concrete classes with ActiveRecord::Observer#observe.  #3998 [Robby Russell, Tarmo Tänav]
608

609
* Added ActiveRecord::Base#to_json/from_json [David Heinemeier Hansson, Cheah Chu Yeow]
610

611
* Added ActiveRecord::Base#from_xml [David Heinemeier Hansson]. Example:
612 613 614 615

    xml = "<person><name>David</name></person>"
    Person.new.from_xml(xml).name # => "David"

616 617
* Define dynamic finders as real methods after first usage. [bscofield]

618 619
* Deprecation: remove deprecated threaded_connections methods. Use allow_concurrency instead.  [Jeremy Kemper]

620
* Associations macros accept extension blocks alongside modules.  #9346 [Josh Peek]
621

622 623
* Speed up and simplify query caching.  [Jeremy Kemper]

624 625
* connection.select_rows 'sql' returns an array (rows) of arrays (field values).  #2329 [Michael Schuerig]

626 627
* Eager loading respects explicit :joins.  #9496 [dasil003]

J
Typo  
Jeremy Kemper 已提交
628
* Extract Firebird, FrontBase, and OpenBase adapters into gems.  #9508, #9509, #9510 [Jeremy Kemper]
629

630 631
* RubyGem database adapters: expects a gem named activerecord-<database>-adapter with active_record/connection_adapters/<database>_adapter.rb in its load path.  [Jeremy Kemper]

632 633
* Fixed that altering join tables in migrations would fail w/ sqlite3 #7453 [TimoMihaljov/brandon]

634 635
* Fix association writer with :dependent => :nullify.  #7314 [Jonathan Viney]

636 637
* OpenBase: update for new lib and latest Rails. Support migrations.  #8748 [dcsesq]

J
Jeremy Kemper 已提交
638
* Moved acts_as_tree into a plugin of the same name on the official Rails svn.  #9514 [Pratik Naik]
639

J
Jeremy Kemper 已提交
640
* Moved acts_as_nested_set into a plugin of the same name on the official Rails svn.  #9516 [Josh Peek]
641

J
Jeremy Kemper 已提交
642
* Moved acts_as_list into a plugin of the same name on the official Rails svn.  [Josh Peek]
643

644 645
* Explicitly require active_record/query_cache before using it.  [Jeremy Kemper]

646
* Fix bug where unserializing an attribute attempts to modify a frozen @attributes hash for a deleted record.  [Rick Olson, marclove]
647

648 649
* Performance: absorb instantiate and initialize_with_callbacks into the Base methods. [Jeremy Kemper]

650
* Fixed that eager loading queries and with_scope should respect the :group option [David Heinemeier Hansson]
651

652 653 654 655
* Improve performance and functionality of the postgresql adapter.  Closes #8049 [roderickvd]

	For more information see: http://dev.rubyonrails.org/ticket/8049

656
* Don't clobber includes passed to has_many.count [Jack Danger Canty]
657

658
* Make sure has_many uses :include when counting [Jack Danger Canty]
659

660
* Change the implementation of ActiveRecord's attribute reader and writer methods [Michael Koziarski]
661 662 663 664 665
 - 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.

666
* Perform a deep #dup on query cache results so that modifying activerecord attributes does not modify the cached attributes.  [Rick Olson]
667

J
Jeremy Kemper 已提交
668
# Ensure that has_many :through associations use a count query instead of loading the target when #size is called.  Closes #8800 [Pratik Naik]
669

670 671 672 673 674 675 676 677 678 679
* 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?

J
Jeremy Kemper 已提交
680
* Fix #count on a has_many :through association so that it recognizes the :uniq option.  Closes #8801 [Pratik Naik]
681

J
Jeremy Kemper 已提交
682
* Fix and properly document/test count(column_name) usage. Closes #8999 [Pratik Naik]
683

J
Jeremy Kemper 已提交
684
* Remove deprecated count(conditions=nil, joins=nil) usage.  Closes #8993 [Pratik Naik]
685

686
* Change belongs_to so that the foreign_key assumption is taken from the association name, not the class name.  Closes #8992 [Josh Susser]
687 688 689 690 691 692 693

  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

J
Jeremy Kemper 已提交
694
* Remove spurious tests from deprecated_associations_test, most of these aren't deprecated, and are duplicated in associations_test.  Closes #8987 [Pratik Naik]
695

J
Jeremy Kemper 已提交
696
* Make create! on a has_many :through association return the association object.  Not the collection.  Closes #8786 [Pratik Naik]
697

698 699
* Move from select * to select tablename.* to avoid clobbering IDs. Closes #8889 [dasil003]

700
* Don't call unsupported methods on associated objects when using :include, :method with to_xml #7307, [Manfred Stienstra, jwilger]
701

J
Jeremy Kemper 已提交
702
* Define collection singular ids method for has_many :through associations.  #8763 [Pratik Naik]
703

J
Jeremy Kemper 已提交
704
* Array attribute conditions work with proxied association collections.  #8318 [Kamal Fariz Mahyuddin, theamazingrando]
705

J
Jeremy Kemper 已提交
706
* Fix polymorphic has_one associations declared in an abstract class.  #8638 [Pratik Naik, Dax Huiberts]
707

J
Jeremy Kemper 已提交
708
* Fixed validates_associated should not stop on the first error.  #4276 [mrj, Manfred Stienstra, Josh Peek]
709

710 711
* Rollback if commit raises an exception.  #8642 [kik, Jeremy Kemper]

J
Jeremy Kemper 已提交
712
* Update tests' use of fixtures for the new collections api.  #8726 [Kamal Fariz Mahyuddin]
713

714
* Save associated records only if the association is already loaded.  #8713 [Blaine]
715

716 717
* MySQL: fix show_variable.  #8448 [matt, Jeremy Kemper]

718 719
* Fixtures: correctly delete and insert fixtures in a single transaction.  #8553 [Michael Schuerig]

720 721
* Fixtures: people(:technomancy, :josh) returns both fixtures.  #7880 [technomancy, Josh Peek]

J
Jeremy Kemper 已提交
722
* Calculations support non-numeric foreign keys.  #8154 [Kamal Fariz Mahyuddin]
723

724 725
* with_scope is protected.  #8524 [Josh Peek]

726 727
* Quickref for association methods.  #7723 [marclove, Mindsweeper]

728 729
* Calculations: return nil average instead of 0 when there are no rows to average.  #8298 [davidw]

730 731
* acts_as_nested_set: direct_children is sorted correctly.  #4761 [Josh Peek, rails@33lc0.net]

732 733
* Raise an exception if both attr_protected and attr_accessible are declared.  #8507 [stellsmi]

734 735
* SQLite, MySQL, PostgreSQL, Oracle: quote column names in column migration SQL statements.  #8466 [marclove, lorenjohnson]

736 737
* Allow nil serialized attributes with a set class constraint.  #7293 [sandofsky]

738 739 740 741
* Oracle: support binary fixtures.  #7987 [Michael Schoen]

* Fixtures: pull fixture insertion into the database adapters.  #7987 [Michael Schoen]

742 743
* Announce migration versions as they're performed.  [Jeremy Kemper]

744 745
* find gracefully copes with blank :conditions.  #7599 [Dan Manges, johnnyb]

746 747
* 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]

748 749
* MySQL: create_database takes :charset and :collation options. Charset defaults to utf8.  #8448 [matt]

750 751
* Find with a list of ids supports limit/offset.  #8437 [hrudududu]

752 753
* Optimistic locking: revert the lock version when an update fails.  #7840 [plang]

754 755
* Migrations: add_column supports custom column types.  #7742 [jsgarvin, Theory]

756 757
* 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]

758
* Ensure that associations with :dependent => :delete_all respect :conditions option.  Closes #8034 [Jack Danger Canty, Josh Peek, Rick Olson]
R
Rick Olson 已提交
759

760 761
* belongs_to assignment creates a new proxy rather than modifying its target in-place.  #8412 [mmangino@elevatedrails.com]

762 763
* Fix column type detection while loading fixtures.  Closes #7987 [roderickvd]

764 765 766
* 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]
767

768
* Sanitize Base#inspect.  #8392, #8623 [Nik Wakelin, jnoon]
769

770
* Replace the transaction {|transaction|..} semantics with a new Exception ActiveRecord::Rollback.   [Michael Koziarski]
771

772 773
* Oracle: extract column length for CHAR also.  #7866 [ymendel]

774 775
* Document :allow_nil option for validates_acceptance_of since it defaults to true. [tzaharia]

776
* Update documentation for :dependent declaration so that it explicitly uses the non-deprecated API. [Jack Danger Canty]
777

778 779
* Add documentation caveat about when to use count_by_sql. [fearoffish]

780
* Enhance documentation for increment_counter and decrement_counter. [fearoffish]
781

782 783
* Provide brief introduction to what optimistic locking is. [fearoffish]

784 785
* Add documentation for :encoding option to mysql adapter. [marclove]

786
* Added short-hand declaration style to migrations (inspiration from Sexy Migrations, http://errtheblog.com/post/2381) [David Heinemeier Hansson]. Example:
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804

    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

805
* 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]
806

807 808
* Improve performance of calling .create on has_many :through associations. [evan]

809 810
* Improved cloning performance by relying less on exception raising #8159 [Blaine]

811
* Added ActiveRecord::Base.inspect to return a column-view like #<Post id:integer, title:string, body:text> [David Heinemeier Hansson]
812

813
* Added yielding of Builder instance for ActiveRecord::Base#to_xml calls [David Heinemeier Hansson]
814

815
* Small additions and fixes for ActiveRecord documentation.  Closes #7342 [Jeremy McAnally]
816

817 818
* Add helpful debugging info to the ActiveRecord::StatementInvalid exception in ActiveRecord::ConnectionAdapters::SqliteAdapter#table_structure.  Closes #7925. [court3nay]

819 820
* SQLite: binary escaping works with $KCODE='u'.  #7862 [tsuka]

821 822
* Base#to_xml supports serialized attributes.  #7502 [jonathan]

823 824
* Base.update_all :order and :limit options. Useful for MySQL updates that must be ordered to avoid violating unique constraints.  [Jeremy Kemper]

825
* Remove deprecated object transactions.  People relying on this functionality should install the object_transactions plugin at http://code.bitsweat.net/svn/object_transactions.  Closes #5637 [Michael Koziarski, Jeremy Kemper]
826

827 828
* 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]

829 830
* 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]

831
* 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]
832

833 834
* Allow a polymorphic :source for has_many :through associations.  Closes #7143 [protocool]

835
* Consistent public/protected/private visibility for chained methods.  #7813 [Dan Manges]
836

837 838
* Oracle: fix quoted primary keys and datetime overflow.  #7798 [Michael Schoen]

839 840
* Consistently quote primary key column names.  #7763 [toolmantim]

841 842
* Fixtures: fix YAML ordered map support.  #2665 [Manuel Holtgrewe, nfbuckley]

843 844
* DateTimes assume the default timezone.  #7764 [Geoff Buesing]

845 846
* Sybase: hide timestamp columns since they're inherently read-only.  #7716 [Mike Joyce]

847 848
* Oracle: overflow Time to DateTime.  #7718 [Michael Schoen]

849
* PostgreSQL: don't use async_exec and async_query with postgres-pr.  #7727, #7762 [flowdelic, toolmantim]
850

851 852
* Fix has_many :through << with custom foreign keys.  #6466, #7153 [naffis, Rich Collins]

853 854
* Test DateTime native type in migrations, including an edge case with dates
during calendar reform.  #7649, #7724 [fedot, Geoff Buesing]
855

856
* SQLServer: correctly schema-dump tables with no indexes or descending indexes.  #7333, #7703 [Jakob Skjerning, Tom Ward]
857 858 859

* SQLServer: recognize real column type as Ruby float.  #7057 [sethladd, Tom Ward]

860
* Added fixtures :all as a way of loading all fixtures in the fixture directory at once #7214 [Manfred Stienstra]
861

862
* Added database connection as a yield parameter to ActiveRecord::Base.transaction so you can manually rollback [David Heinemeier Hansson]. Example:
863 864 865 866 867 868 869

    transaction do |transaction|
      david.withdrawal(100)
      mary.deposit(100)
      transaction.rollback! # rolls back the transaction that was otherwise going to be successful
    end

870 871
* Made increment_counter/decrement_counter play nicely with optimistic locking, and added a more general update_counters method [Jamis Buck]

872
* 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]
873 874
  Task.cache { Task.find(1); Task.find(1) } #=> 1 query
  
875 876
* 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]

877 878
* Oracle: fix lob and text default handling.  #7344 [gfriedrich, Michael Schoen]

879
* SQLServer: don't choke on strings containing 'null'.  #7083 [Jakob Skjerning]
880

881 882
* MySQL: blob and text columns may not have defaults in 5.x. Update fixtures schema for strict mode.  #6695 [Dan Kubb]

883 884
* 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]

885 886
* MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last inserted id.  #6778 [Jonathan Viney, timc]

887 888
* Use Date#to_s(:db) for quoted dates.  #7411 [Michael Schoen]

889
* Don't create instance writer methods for class attributes.  Closes #7401 [Rick Olson]
890

891 892
* Docs: validations examples.  #7343 [zackchandler]

893 894
* Add missing tests ensuring callbacks work with class inheritance.  Closes #7339 [sandofsky]

895 896
* Fixtures use the table name and connection from set_fixture_class.  #7330 [Anthony Eden]

897 898 899 900
* Remove useless code in #attribute_present? since 0 != blank?.  Closes #7249 [Josh Susser]

* Fix minor doc typos. Closes #7157 [Josh Susser]

901 902
* Fix incorrect usage of #classify when creating the eager loading join statement.  Closes #7044 [Josh Susser]

903 904
* SQLServer: quote table name in indexes query.  #2928 [keithm@infused.org]

905 906
* Subclasses of an abstract class work with single-table inheritance.  #5704, #7284 [BertG, nick+rails@ag.arizona.edu]

907 908
* Make sure sqlite3 driver closes open connections on disconnect [Rob Rasmussen]

909
* [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name.  #7072 [Jeremy McAnally]
910

911
* change_column accepts :default => nil. Skip column options for primary keys.  #6956, #7048 [Dan Manges, Jeremy Kemper]
912

913
* 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]
914

915 916
* Oracle: create_table takes a :sequence_name option to override the 'tablename_seq' default.  #7000 [Michael Schoen]

917 918
* MySQL: retain SSL settings on reconnect.  #6976 [randyv2]

919 920
* Apply scoping during initialize instead of create.  Fixes setting of foreign key when using find_or_initialize_by with scoping. [Cody Fauser]

921 922
* SQLServer: handle [quoted] table names.  #6635 [rrich]

923 924
* acts_as_nested_set works with single-table inheritance.  #6030 [Josh Susser]

925
* PostgreSQL, Oracle: correctly perform eager finds with :limit and :order.  #4668, #7021 [eventualbuddha, Michael Schoen]
926

927
* Pass a range in :conditions to use the SQL BETWEEN operator.  #6974 [Dan Manges]
928 929
    Student.find(:all, :conditions => { :grade => 9..12 })

930 931
* Fix the Oracle adapter for serialized attributes stored in CLOBs.  Closes #6825 [mschoen, tdfowler]

932 933
* [DOCS] Apply more documentation for ActiveRecord Reflection.  Closes #4055 [Robby Russell]

934 935
* [DOCS] Document :allow_nil option of #validate_uniqueness_of. Closes #3143 [Caio Chassot]

936 937
* Bring the sybase adapter up to scratch for 1.2 release. [jsheets]

938
* Rollback new_record? and id when an exception is raised in a save callback.  #6910 [Ben Curren, outerim]
939

940 941
* Pushing a record on an association collection doesn't unnecessarily load all the associated records.  [Obie Fernandez, Jeremy Kemper]

942 943
* Oracle: fix connection reset failure.  #6846 [leonlleslie]

944 945
* Subclass instantiation doesn't try to explicitly require the corresponding subclass.  #6840 [leei, Jeremy Kemper]

946 947
* 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]

948
* 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]
949

950 951
* find supports :lock with :include. Check whether your database allows SELECT ... FOR UPDATE with outer joins before using.  #6764 [vitaly, Jeremy Kemper]

952 953
* Add AssociationCollection#create! to be consistent with AssociationCollection#create when dealing with a foreign key that is a protected attribute [Cody Fauser]

954
* 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]
955

956
* Change fixture_path to a class inheritable accessor allowing test cases to have their own custom set of fixtures. #6672 [Zach Dennis]
957

958 959
* Quote ActiveSupport::Multibyte::Chars.  #6653 [Julian Tarkhanov]

960 961
* Simplify query_attribute by typecasting the attribute value and checking whether it's nil, false, zero or blank.  #6659 [Jonathan Viney]

962 963
* 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]

964 965
* Run validations in the order they were declared.  #6657 [obrie]

966
* 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]
967

968 969
* Simplify association proxy implementation by factoring construct_scope out of method_missing.  #6643 [martin]

970 971
* Oracle: automatically detect the primary key.  #6594 [vesaria, Michael Schoen]

J
Jeremy Kemper 已提交
972
* 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]
973

974 975
* Don't inspect unloaded associations.  #2905 [lmarlow]

976
* SQLite: use AUTOINCREMENT primary key in >= 3.1.0.  #6588, #6616 [careo, lukfugl]
977

978 979
* Cache inheritance_column.  #6592 [Stefan Kaes]

980 981
* Firebird: decimal/numeric support.  #6408 [macrnic]

982 983
* make add_order a tad faster. #6567 [Stefan Kaes]

984 985
* Find with :include respects scoped :order.  #5850

986 987 988
* Support nil and Array in :conditions => { attr => value } hashes.  #6548 [Assaf, Jeremy Kemper]
    find(:all, :conditions => { :topic_id => [1, 2, 3], :last_read => nil }

989 990
* 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]

991 992 993 994
* 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]

995 996
* Dynamically generate reader methods for serialized attributes.  #6362 [Stefan Kaes]

997 998
* Deprecation: object transactions warning.  [Jeremy Kemper]

999
* has_one :dependent => :nullify ignores nil associates.  #4848, #6528 [bellis@deepthought.org, janovetz, Jeremy Kemper]
1000

1001
* 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]
1002

1003 1004
* Make add_column use the options hash with the Sqlite Adapter. Closes #6464 [obrie]

1005 1006
* Document other options available to migration's add_column. #6419 [grg]

1007
* MySQL: all_hashes compatibility with old MysqlRes class.  #6429, #6601 [Jeremy Kemper]
1008

1009 1010
* Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes #5783. [Jonathan Viney]

1011
* fix select_limited_ids_list issues in postgresql, retain current behavior in other adapters [Rick Olson]
1012

1013
* Restore eager condition interpolation, document it's differences [Rick Olson]
1014

1015
* 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]
1016

1017 1018
* Add #delete support to has_many :through associations.  Closes #6049 [Martin Landers]

1019
* Reverted old select_limited_ids_list postgresql fix that caused issues in mysql.  Closes #5851 [Rick Olson]
1020

1021 1022
* 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]

1023 1024
* 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]

1025 1026
* Added update_attributes! which uses save! to raise an exception if a validation error prevents saving #6192 [jonathan]

1027
* Deprecated add_on_boundary_breaking (use validates_length_of instead) #6292 [Bob Silva]
1028

1029 1030
* The has_many create method works with polymorphic associations.  #6361 [Dan Peterson]

1031 1032
* MySQL: introduce Mysql::Result#all_hashes to support further optimization.  #5581 [Stefan Kaes]

1033 1034
* save! shouldn't validate twice.  #6324 [maiha, Bob Silva]

1035 1036
* 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]

1037 1038
* Add an attribute reader method for ActiveRecord::Base.observers [Rick Olson]

1039 1040
* Deprecation: count class method should be called with an options hash rather than two args for conditions and joins.  #6287 [Bob Silva]

1041 1042
* has_one associations with a nil target may be safely marshaled.  #6279 [norbauer, Jeremy Kemper]

1043
* Duplicate the hash provided to AR::Base#to_xml to prevent unexpected side effects [Michael Koziarski]
1044

1045
* Add a :namespace option to  AR::Base#to_xml [Michael Koziarski]
1046

1047 1048
* Deprecation tests. Remove warnings for dynamic finders and for the foo_count method if it's also an attribute. [Jeremy Kemper]

1049 1050
* Mock Time.now for more accurate Touch mixin tests.  #6213 [Dan Peterson]

1051 1052
* Improve yaml fixtures error reporting.  #6205 [Bruce Williams]

1053
* Rename AR::Base#quote so people can use that name in their models. #3628 [Michael Koziarski]
1054

1055 1056
* Add deprecation warning for inferred foreign key. #6029 [Josh Susser]

1057 1058
* 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]

1059 1060
* Deprecation: use :dependent => :delete_all rather than :exclusively_dependent => true.  #6024 [Josh Susser]

1061 1062
* Document validates_presences_of behavior with booleans: you probably want validates_inclusion_of :attr, :in => [true, false].  #2253 [Bob Silva]

1063 1064
* Optimistic locking: gracefully handle nil versions, treat as zero.  #5908 [Tom Ward]

1065 1066
* to_xml: the :methods option works on arrays of records.  #5845 [Josh Starcher]

1067
* Deprecation: update docs. #5998 [Jakob Skjerning, Kevin Clark]
1068

1069 1070
* Add some XmlSerialization tests for ActiveRecord [Rick Olson]

1071 1072
* has_many :through conditions are sanitized by the associating class.  #5971 [martin.emde@gmail.com]

1073 1074
* Tighten rescue clauses.  #5985 [james@grayproductions.net]

1075 1076
* Fix spurious newlines and spaces in AR::Base#to_xml output [Jamis Buck]

1077 1078
* 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]

1079 1080
* Nested subclasses are not prefixed with the parent class' table_name since they should always use the base class' table_name.  #5911 [Jonathan Viney]

1081 1082
* 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]

1083 1084
* SQLServer: fix eager association test.  #5901 [Tom Ward]

1085 1086
* Clashing type columns due to a sloppy join shouldn't wreck single-table inheritance.  #5838 [Kevin Clark]

1087 1088
* Fixtures: correct escaping of \n and \r.  #5859 [evgeny.zislis@gmail.com]

1089 1090
* Migrations: gracefully handle missing migration files.  #5857 [eli.gordon@gmail.com]

1091 1092
* MySQL: update test schema for MySQL 5 strict mode.  #5861 [Tom Ward]

1093
* to_xml: correct naming of included associations.  #5831 [Josh Starcher]
1094

1095
* 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]
1096

1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108
* 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

1109 1110
* Cache nil results for :included has_one associations also.  #5787 [Michael Schoen]

1111
* 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]
1112

1113 1114 1115
* 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

1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
* 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

1129 1130
* Fix for deep includes on the same association. [richcollins@gmail.com]

1131 1132
* Tweak fixtures so they don't try to use a non-ActiveRecord class.  [Kevin Clark]

1133 1134
* Remove ActiveRecord::Base.reset since Dispatcher doesn't use it anymore.  [Rick Olson]

1135 1136
* Document find's :from option. Closes #5762. [andrew@redlinesoftware.com]

1137 1138
* 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]

1139 1140
* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]

1141
* Cache nil results for has_one associations so multiple calls don't call the database.  Closes #5757. [Michael Schoen]
1142

1143 1144
* Add documentation for how to disable timestamps on a per model basis. Closes #5684. [matt@mattmargolis.net Marcel Molina Jr.] 

1145 1146
* Don't save has_one associations unnecessarily.  #5735 [Jonathan Viney]

1147 1148
* Refactor ActiveRecord::Base.reset_subclasses to #reset, and add global observer resetting.  [Rick Olson]

1149
* Formally deprecate the deprecated finders. [Michael Koziarski]
1150

1151
* Formally deprecate rich associations.  [Michael Koziarski]
1152

1153 1154
* Fixed that default timezones for new / initialize should uphold utc setting #5709 [daniluk@yahoo.com]

1155 1156
* Fix announcement of very long migration names.  #5722 [blake@near-time.com]

1157 1158
* The exists? class method should treat a string argument as an id rather than as conditions.  #5698 [jeremy@planetargon.com]

1159 1160
* Fixed to_xml with :include misbehaviors when invoked on array of model instances #5690 [alexkwolfe@gmail.com]

J
Jeremy Kemper 已提交
1161
* Added support for conditions on Base.exists? #5689 [Josh Peek]. Examples:
1162 1163 1164 1165 1166

    assert (Topic.exists?(:author_name => "David")) 
 	  assert (Topic.exists?(:author_name => "Mary", :approved => true)) 
 	  assert (Topic.exists?(["parent_id = ?", 1]))

1167 1168
* Schema dumper quotes date :default values. [Dave Thomas]

1169 1170
* Calculate sum with SQL, not Enumerable on HasManyThrough Associations. [Dan Peterson]

1171 1172
* Factor the attribute#{suffix} methods out of method_missing for easier extension. [Jeremy Kemper]

1173 1174
* Patch sql injection vulnerability when using integer or float columns. [Jamis Buck]

1175 1176
* Allow #count through a has_many association to accept :include.  [Dan Peterson]

1177 1178
* create_table rdoc: suggest :id => false for habtm join tables. [Zed Shaw]

1179 1180
* PostgreSQL: return array fields as strings. #4664 [Robby Russell]

1181 1182 1183 1184
* 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]

1185
* Oracle: BigDecimal support. #5667 [Michael Schoen]
1186

1187 1188
* 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]

1189 1190
* Firebird migrations support. #5337 [Ken Kunz <kennethkunz@gmail.com>]

1191 1192
* PostgreSQL: create/drop as postgres user. #4790 [mail@matthewpainter.co.uk, mlaster@metavillage.com]

1193 1194
* Update callbacks documentation. #3970 [Robby Russell <robby@planetargon.com>]

1195 1196
* PostgreSQL: correctly quote the ' in pk_and_sequence_for. #5462 [tietew@tietew.net]

1197 1198
* PostgreSQL: correctly quote microseconds in timestamps. #5641 [rick@rickbradley.com]

1199 1200
* Clearer has_one/belongs_to model names (account has_one :user). #5632 [matt@mattmargolis.net]

1201
* 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]
1202

1203
* 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]
1204

1205 1206
* Added :group to available options for finds done on associations #5516 [mike@michaeldewey.org]

1207 1208
* Minor tweak to improve performance of ActiveRecord::Base#to_param.

1209 1210
* Observers also watch subclasses created after they are declared. #5535 [daniels@pronto.com.au]

1211 1212
* Removed deprecated timestamps_gmt class methods. [Jeremy Kemper]

1213 1214
* rake build_mysql_database grants permissions to rails@localhost. #5501 [brianegge@yahoo.com]

1215 1216
* PostgreSQL: support microsecond time resolution. #5492 [alex@msgpad.com]

1217 1218
* Add AssociationCollection#sum since the method_missing invokation has been shadowed by Enumerable#sum.

1219 1220
* Added find_or_initialize_by_X which works like find_or_create_by_X but doesn't save the newly instantiated record. [Sam Stephenson]

1221
* 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]
1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233
    # 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]

1234 1235
* Change AR::Base#to_param to return a String instead of a Fixnum. Closes #5320. [Nicholas Seckar]

1236 1237
* Use explicit delegation instead of method aliasing for AR::Base.to_param -> AR::Base.id. #5299 (skaes@web.de)

1238
* 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]
1239

1240
* Added simple hash conditions to find that'll just convert hash to an AND-based condition string #5143 [Hampton Catlin]. Example:
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250

    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.
    

1251 1252
* Fixed issues with BLOB limits, charsets, and booleans for Firebird #5194, #5191, #5189 [kennethkunz@gmail.com]

1253 1254
* Fixed usage of :limit and with_scope when the association in scope is a 1:m #5208 [alex@purefiction.net]

1255 1256
* Fixed migration trouble with SQLite when NOT NULL is used in the new definition #5215 [greg@lapcominc.com]

1257 1258
* Fixed problems with eager loading and counting on SQL Server #5212 [kajism@yahoo.com]

1259 1260
* Fixed that count distinct should use the selected column even when using :include #5251 [anna@wota.jp]

1261 1262
* 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]

1263 1264
* Allow models to override to_xml.  #4989 [Blair Zajac <blair@orcaware.com>]

1265 1266
* PostgreSQL: don't ignore port when host is nil since it's often used to label the domain socket.  #5247 [shimbo@is.naist.jp]

1267 1268 1269 1270
* 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])

1271
* Fixed that Base.find :all, :conditions => [ "id IN (?)", collection ] would fail if collection was empty [David Heinemeier Hansson]
1272

1273
* Add a list of regexes assert_queries skips in the ActiveRecord test suite.  [Rick Olson]
1274

1275
* Fix the has_and_belongs_to_many #create doesn't populate the join for new records.  Closes #3692 [Josh Susser]
1276

1277
* Provide Association Extensions access to the instance that the association is being accessed from.  
1278
  Closes #4433 [Josh Susser]
1279

1280 1281
* Update OpenBase adaterp's maintainer's email address. Closes #5176. [Derrick Spell]

1282
* Add a quick note about :select and eagerly included associations. [Rick Olson]
1283

1284 1285
* Add docs for the :as option in has_one associations.  Closes #5144 [cdcarter@gmail.com]

1286
* Fixed that has_many collections shouldn't load the entire association to do build or create [David Heinemeier Hansson]
1287

1288
* Added :allow_nil option for aggregations #5091 [Ian White]
1289

1290
* Fix Oracle boolean support and tests. Closes #5139. [Michael Schoen]
1291

1292 1293
* 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]

1294 1295
* Call Inflector#demodulize on the class name when eagerly including an STI model.  Closes #5077 [info@loobmedia.com]

1296 1297
* Preserve MySQL boolean column defaults when changing a column in a migration. Closes #5015. [pdcawley@bofh.org.uk] 

1298 1299
* 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]

1300 1301
* Dates and times interpret empty strings as nil rather than 2000-01-01. #4830 [kajism@yahoo.com]

1302 1303
* Allow :uniq => true with has_many :through associations. [Jeremy Kemper]

1304 1305
* Ensure that StringIO is always available for the Schema dumper. [Marcel Molina Jr.]

1306 1307
* Allow AR::Base#to_xml to include methods too. Closes #4921. [johan@textdrive.com] 

1308 1309
* Replace superfluous name_to_class_name variant with camelize. [Marcel Molina Jr.]

1310 1311
* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]

1312 1313
* Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]

1314 1315
* Remove duplicate fixture entry in comments.yml. Closes #4923. [Blair Zajac <blair@orcaware.com>]

1316 1317
* Update FrontBase adapter to check binding version. Closes #4920. [mlaster@metavillage.com] 

1318 1319
* New Frontbase connections don't start in auto-commit mode. Closes #4922. [mlaster@metavillage.com]

1320 1321
* When grouping, use the appropriate option key. [Marcel Molina Jr.]

1322 1323
* Only modify the sequence name in the FrontBase adapter if the FrontBase adapter is actually being used. [Marcel Molina Jr.]

1324 1325
* Add support for FrontBase (http://www.frontbase.com/) with a new adapter thanks to the hard work of one Mike Laster. Closes #4093. [mlaster@metavillage.com]

1326 1327
* Add warning about the proper way to validate the presence of a foreign key. Closes #4147. [Francois Beausoleil <francois.beausoleil@gmail.com>]

1328
* Fix syntax error in documentation. Closes #4679. [Mislav Marohnić] 
1329

1330 1331
* Add Oracle support for CLOB inserts. Closes #4748. [schoenm@earthlink.net sandra.metz@duke.edu] 

1332 1333
* Various fixes for sqlserver_adapter (odbc statement finishing, ado schema dumper, drop index). Closes #4831. [kajism@yahoo.com]

1334 1335
* Add support for :order option to with_scope. Closes #3887. [eric.daspet@survol.net]

1336 1337
* Prettify output of schema_dumper by making things line up. Closes #4241 [Caio  Chassot <caio@v2studio.com>]

1338
* Make build_postgresql_databases task make databases owned by the postgres user. Closes #4790. [mlaster@metavillage.com]
1339

1340 1341
* Sybase Adapter type conversion cleanup. Closes #4736. [dev@metacasa.net]

1342
* Fix bug where calculations with long alias names return null. [Rick Olson]
1343

1344
* Raise error when trying to add to a has_many :through association.  Use the Join Model instead. [Rick Olson]
1345 1346 1347 1348

    @post.tags << @tag                  # BAD
    @post.taggings.create(:tag => @tag) # GOOD

1349
* Allow all calculations to take the :include option, not just COUNT (closes #4840) [Rick Olson]
1350

1351 1352
* Update inconsistent migrations documentation. #4683 [machomagna@gmail.com]

J
Jamis Buck 已提交
1353 1354
* Add ActiveRecord::Errors#to_xml [Jamis Buck]

1355 1356
* Properly quote index names in migrations (closes #4764) [John Long]

1357
* Fix the HasManyAssociation#count method so it uses the new ActiveRecord::Base#count syntax, while maintaining backwards compatibility.  [Rick Olson]
R
Rick Olson 已提交
1358

1359
* Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions [Rick Olson]
1360

1361
* Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. [Rick Olson]
1362

1363 1364 1365 1366
* DRY up association collection reader method generation. [Marcel Molina Jr.]

* DRY up and tweak style of the validation error object. [Marcel Molina Jr.]

1367
* Add :case_sensitive option to validates_uniqueness_of (closes #3090) [Rick Olson]
1368 1369 1370 1371 1372

    class Account < ActiveRecord::Base
      validates_uniqueness_of :email, :case_sensitive => false
    end

1373 1374 1375 1376 1377 1378
* Allow multiple association extensions with :extend option (closes #4666) [Josh Susser]

    class Account < ActiveRecord::Base
      has_many :people, :extend => [FindOrCreateByNameExtension, FindRecentExtension]
    end

1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391
    *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)

1392
* Pass a range in :conditions to use the SQL BETWEEN operator.  #6974 [Dan Manges]
1393 1394
    Student.find(:all, :conditions => { :grade => 9..12 })

1395
* Don't create instance writer methods for class attributes. [Rick Olson]
1396 1397 1398

* 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]

1399
* SQLServer: don't choke on strings containing 'null'.  #7083 [Jakob Skjerning]
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416

* 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)

1417
* [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name.  #7072 [Jeremy McAnally]
1418

1419
* change_column accepts :default => nil. Skip column options for primary keys.  #6956, #7048 [Dan Manges, Jeremy Kemper]
1420

1421
* 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]
1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481

* 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]

1482
* fix select_limited_ids_list issues in postgresql, retain current behavior in other adapters [Rick Olson]
1483

1484
* Restore eager condition interpolation, document it's differences [Rick Olson]
1485 1486 1487 1488 1489

* 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]

1490
* Reverted old select_limited_ids_list postgresql fix that caused issues in mysql.  Closes #5851 [Rick Olson]
1491 1492 1493 1494 1495 1496 1497

* 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]

1498
* Deprecated add_on_boundary_breaking (use validates_length_of instead) #6292 [Bob Silva]
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513

* 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]

1514
* Duplicate the hash provided to AR::Base#to_xml to prevent unexpected side effects [Michael Koziarski]
1515

1516
* Add a :namespace option to  AR::Base#to_xml [Michael Koziarski]
1517 1518 1519 1520 1521 1522 1523

* 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]

1524
* Rename AR::Base#quote so people can use that name in their models. #3628 [Michael Koziarski]
1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553

* 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]

1554
* to_xml: correct naming of included associations.  #5831 [Josh Starcher]
1555

1556
* 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]
1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571

* 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]

1572
* 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]
1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599

* 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]

1600
* Cache nil results for has_one associations so multiple calls don't call the database.  Closes #5757. [Michael Schoen]
1601 1602 1603 1604 1605

* Don't save has_one associations unnecessarily.  #5735 [Jonathan Viney]

* Refactor ActiveRecord::Base.reset_subclasses to #reset, and add global observer resetting.  [Rick Olson]

1606
* Formally deprecate the deprecated finders. [Michael Koziarski]
1607

1608
* Formally deprecate rich associations.  [Michael Koziarski]
1609 1610 1611 1612 1613 1614 1615 1616 1617

* 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]

J
Jeremy Kemper 已提交
1618
* Added support for conditions on Base.exists? #5689 [Josh Peek]. Examples:
1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641

    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]

1642
* Oracle: BigDecimal support. #5667 [Michael Schoen]
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655

* 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]

1656
* 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]
1657

1658
* 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]
1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690

* 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 for AR::Base.to_param -> AR::Base.id. #5299 (skaes@web.de)

1691
* 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]
1692

1693
* Added simple hash conditions to find that'll just convert hash to an AND-based condition string #5143 [Hampton Catlin]. Example:
1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723

    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])

1724
* Fixed that Base.find :all, :conditions => [ "id IN (?)", collection ] would fail if collection was empty [David Heinemeier Hansson]
1725

1726
* Add a list of regexes assert_queries skips in the ActiveRecord test suite.  [Rick Olson]
1727

1728
* Fix the has_and_belongs_to_many #create doesn't populate the join for new records.  Closes #3692 [Josh Susser]
1729 1730

* Provide Association Extensions access to the instance that the association is being accessed from.  
1731
  Closes #4433 [Josh Susser]
1732 1733 1734

* Update OpenBase adaterp's maintainer's email address. Closes #5176. [Derrick Spell]

1735
* Add a quick note about :select and eagerly included associations. [Rick Olson]
1736 1737 1738

* Add docs for the :as option in has_one associations.  Closes #5144 [cdcarter@gmail.com]

1739
* Fixed that has_many collections shouldn't load the entire association to do build or create [David Heinemeier Hansson]
1740

1741
* Added :allow_nil option for aggregations #5091 [Ian White]
1742

1743
* Fix Oracle boolean support and tests. Closes #5139. [Michael Schoen]
1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768

* 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] 

* Remove duplicate fixture entry in comments.yml. Closes #4923. [Blair Zajac <blair@orcaware.com>]

* When grouping, use the appropriate option key. [Marcel Molina Jr.]

* Add support for FrontBase (http://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>]

1769
* Fix syntax error in documentation. Closes #4679. [Mislav Marohnić] 
1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782

* 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]

1783
* Fix bug where calculations with long alias names return null. [Rick Olson]
1784

1785
* Raise error when trying to add to a has_many :through association.  Use the Join Model instead. [Rick Olson]
1786 1787 1788 1789

    @post.tags << @tag                  # BAD
    @post.taggings.create(:tag => @tag) # GOOD

1790
* Allow all calculations to take the :include option, not just COUNT (closes #4840) [Rick Olson]
1791 1792 1793 1794 1795

* Add ActiveRecord::Errors#to_xml [Jamis Buck]

* Properly quote index names in migrations (closes #4764) [John Long]

1796
* Fix the HasManyAssociation#count method so it uses the new ActiveRecord::Base#count syntax, while maintaining backwards compatibility.  [Rick Olson]
1797

1798
* Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions [Rick Olson]
1799

1800
* Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. [Rick Olson]
1801

1802
* Add :case_sensitive option to validates_uniqueness_of (closes #3090) [Rick Olson]
1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818

    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.14.4* (August 8th, 2006)

* Add warning about the proper way to validate the presence of a foreign key.  #4147 [Francois Beausoleil <francois.beausoleil@gmail.com>]

1819
* Fix syntax error in documentation. #4679 [Mislav Marohnić] 
1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831

* Update inconsistent migrations documentation. #4683 [machomagna@gmail.com]


*1.14.3* (June 27th, 2006)

* Fix announcement of very long migration names.  #5722 [blake@near-time.com]

* Update callbacks documentation. #3970 [Robby Russell <robby@planetargon.com>]

* Properly quote index names in migrations (closes #4764) [John Long]

1832
* Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions [Rick Olson]
1833

1834
* Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. [Rick Olson]
1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847


*1.14.2* (April 9th, 2006)

* Fixed calculations for the Oracle Adapter (closes #4626) [Michael Schoen]


*1.14.1* (April 6th, 2006)

* Fix type_name_with_module to handle type names that begin with '::'. Closes #4614. [Nicholas Seckar]

* Fixed that that multiparameter assignment doesn't work with aggregations (closes #4620) [Lars Pind]

1848
* Enable Limit/Offset in Calculations (closes #4558) [lmarlow]
1849

1850
* Fixed that loading including associations returns all results if Load IDs For Limited Eager Loading returns none (closes #4528) [Rick Olson]
1851 1852 1853

* Fixed HasManyAssociation#find bugs when :finder_sql is set #4600 [lagroue@free.fr]

1854
* Allow AR::Base#respond_to? to behave when @attributes is nil [Ryan Davis]
1855

1856
* Support eager includes when going through a polymorphic has_many association. [Rick Olson]
1857

1858
* Added support for eagerly including polymorphic has_one associations. (closes #4525) [Rick Olson]
1859 1860 1861 1862 1863 1864 1865

    class Post < ActiveRecord::Base
      has_one :tagging, :as => :taggable
    end

    Post.find :all, :include => :tagging

1866
* Added descriptive error messages for invalid has_many :through associations: going through :has_one or :has_and_belongs_to_many [Rick Olson]
1867

1868
* Added support for going through a polymorphic has_many association: (closes #4401) [Rick Olson]
1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885

    class PhotoCollection < ActiveRecord::Base
      has_many :photos, :as => :photographic
      belongs_to :firm
    end

    class Firm < ActiveRecord::Base
      has_many :photo_collections
      has_many :photos, :through => :photo_collections
    end

* Multiple fixes and optimizations in PostgreSQL adapter, allowing ruby-postgres gem to work properly. [ruben.nine@gmail.com]

* Fixed that AssociationCollection#delete_all should work even if the records of the association are not loaded yet. [Florian Weber]

* Changed those private ActiveRecord methods to take optional third argument :auto instead of nil for performance optimizations.  (closes #4456) [Stefan]

1886
* Private ActiveRecord methods add_limit!, add_joins!, and add_conditions! take an OPTIONAL third argument 'scope' (closes #4456) [Rick Olson]
1887

1888
* DEPRECATED: Using additional attributes on has_and_belongs_to_many associations. Instead upgrade your association to be a real join model [David Heinemeier Hansson]
1889

1890
* Fixed that records returned from has_and_belongs_to_many associations with additional attributes should be marked as read only (fixes #4512) [David Heinemeier Hansson]
1891 1892 1893

* Do not implicitly mark recordss of has_many :through as readonly but do mark habtm records as readonly (eventually only on join tables without rich attributes). [Marcel Mollina Jr.]

1894
* Fixed broken OCIAdapter #4457 [Michael Schoen]
1895 1896 1897 1898 1899 1900


*1.14.0* (March 27th, 2006)

* Replace 'rescue Object' with a finer grained rescue. Closes #4431. [Nicholas Seckar]

1901
* Fixed eager loading so that an aliased table cannot clash with a has_and_belongs_to_many join table [Rick Olson]
1902 1903 1904

* Add support for :include to with_scope [andrew@redlinesoftware.com]

1905
* Support the use of public synonyms with the Oracle adapter; required ruby-oci8 v0.1.14 #4390 [Michael Schoen]
1906 1907 1908

* Change periods (.) in table aliases to _'s.  Closes #4251 [jeff@ministrycentered.com]

1909
* Changed has_and_belongs_to_many join to INNER JOIN for Mysql 3.23.x.  Closes #4348 [Rick Olson]
1910

1911
* Fixed issue that kept :select options from being scoped [Rick Olson]
1912

1913
* Fixed db_schema_import when binary types are present #3101 [David Heinemeier Hansson]
1914

1915
* Fixed that MySQL enums should always be returned as strings #3501 [David Heinemeier Hansson]
1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945

* Change has_many :through to use the :source option to specify the source association.  :class_name is now ignored. [Rick Olson]

    class Connection < ActiveRecord::Base
      belongs_to :user
      belongs_to :channel
    end

    class Channel < ActiveRecord::Base
      has_many :connections
      has_many :contacts, :through => :connections, :class_name => 'User' # OLD
      has_many :contacts, :through => :connections, :source => :user      # NEW
    end

* Fixed DB2 adapter so nullable columns will be determines correctly now and quotes from column default values will be removed #4350 [contact@maik-schmidt.de]

* Allow overriding of find parameters in scoped has_many :through calls [Rick Olson]

  In this example, :include => false disables the default eager association from loading.  :select changes the standard
  select clause.  :joins specifies a join that is added to the end of the has_many :through query.

    class Post < ActiveRecord::Base
      has_many :tags, :through => :taggings, :include => :tagging do
        def add_joins_and_select
          find :all, :select => 'tags.*, authors.id as author_id', :include => false,
            :joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id'
        end
      end
    end

1946
* Fixed that schema changes while the database was open would break any connections to a SQLite database (now we reconnect if that error is throw) [David Heinemeier Hansson]
1947

1948
* Don't classify the has_one class when eager loading, it is already singular. Add tests. (closes #4117) [Jonathan Viney]
1949 1950 1951

* Quit ignoring default :include options in has_many :through calls [Mark James]

1952
* Allow has_many :through associations to find the source association by setting a custom class (closes #4307) [Jonathan Viney]
1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971

* Eager Loading support added for has_many :through => :has_many associations (see below).  [Rick Olson]

* Allow has_many :through to work on has_many associations (closes #3864) [sco@scottraymond.net]  Example:

    class Firm < ActiveRecord::Base
      has_many :clients
      has_many :invoices, :through => :clients
    end

    class Client < ActiveRecord::Base
      belongs_to :firm
      has_many   :invoices
    end

    class Invoice < ActiveRecord::Base
      belongs_to :client
    end

1972
* Raise error when trying to select many polymorphic objects with has_many :through or :include (closes #4226) [Josh Susser]
1973

1974
* Fixed has_many :through to include :conditions set on the :through association. closes #4020 [Jonathan Viney]
1975

1976
* Fix that has_many :through honors the foreign key set by the belongs_to association in the join model (closes #4259) [andylien@gmail.com / Rick Olson]
1977

1978
* SQL Server adapter gets some love #4298 [Ryan Tomayko]
1979 1980 1981 1982 1983 1984 1985

* Added OpenBase database adapter that builds on top of the http://www.spice-of-life.net/ruby-openbase/ driver. All functionality except LIMIT/OFFSET is supported #3528 [derrickspell@cdmplus.com]

* Rework table aliasing to account for truncated table aliases.  Add smarter table aliasing when doing eager loading of STI associations. This allows you to use the association name in the order/where clause. [Jonathan Viney / Rick Olson] #4108 Example (SpecialComment is using STI):

    Author.find(:all, :include => { :posts => :special_comments }, :order => 'special_comments.body')

1986
* Add AbstractAdapter#table_alias_for to create table aliases according to the rules of the current adapter. [Rick Olson]
1987

1988
* Provide access to the underlying database connection through Adapter#raw_connection. Enables the use of db-specific methods without complicating the adapters. #2090 [Michael Koziarski]
1989

1990
* Remove broken attempts at handling columns with a default of 'now()' in the postgresql adapter. #2257 [Michael Koziarski]
1991

1992
* Added connection#current_database that'll return of the current database (only works in MySQL, SQL Server, and Oracle so far -- please help implement for the rest of the adapters) #3663 [Tom Ward]
1993 1994 1995 1996 1997

* Fixed that Migration#execute would have the table name prefix appended to its query #4110 [mark.imbriaco@pobox.com]

* Make all tinyint(1) variants act like boolean in mysql (tinyint(1) unsigned, etc.) [Jamis Buck]

1998
* Use association's :conditions when eager loading. [Jeremy Evans] #4144
1999

2000
* Alias the has_and_belongs_to_many join table on eager includes. #4106 [Jeremy Evans]
2001 2002 2003 2004 2005

  This statement would normally error because the projects_developers table is joined twice, and therefore joined_on would be ambiguous.

    Developer.find(:all, :include => {:projects => :developers}, :conditions => 'join_project_developers.joined_on IS NOT NULL')

2006
* Oracle adapter gets some love #4230 [Michael Schoen]
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040

    * Changes :text to CLOB rather than BLOB [Moses Hohman]
    * Fixes an issue with nil numeric length/scales (several)
    * Implements support for XMLTYPE columns [wilig / Kubo Takehiro]
    * Tweaks a unit test to get it all green again
    * Adds support for #current_database

* Added Base.abstract_class? that marks which classes are not part of the Active Record hierarchy #3704 [Rick Olson]

    class CachedModel < ActiveRecord::Base
      self.abstract_class = true
    end

    class Post < CachedModel
    end

    CachedModel.abstract_class?
    => true

    Post.abstract_class?
    => false

    Post.base_class
    => Post

    Post.table_name
    => 'posts'

* Allow :dependent options to be used with polymorphic joins. #3820 [Rick Olson]

    class Foo < ActiveRecord::Base
      has_many :attachments, :as => :attachable, :dependent => :delete_all
    end

2041
* Nicer error message on has_many :through when :through reflection can not be found. #4042 [court3nay]
2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052

* Upgrade to Transaction::Simple 1.3 [Jamis Buck]

* Catch FixtureClassNotFound when using instantiated fixtures on a fixture that has no ActiveRecord model [Rick Olson]

* Allow ordering of calculated results and/or grouped fields in calculations [solo@gatelys.com]

* Make ActiveRecord::Base#save! return true instead of nil on success.  #4173 [johan@johansorensen.com]

* Dynamically set allow_concurrency.  #4044 [Stefan Kaes]

2053
* Added Base#to_xml that'll turn the current record into a XML representation [David Heinemeier Hansson]. Example:
2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187

    topic.to_xml

  ...returns:

    <?xml version="1.0" encoding="UTF-8"?>
    <topic>
      <title>The First Topic</title>
      <author-name>David</author-name>
      <id type="integer">1</id>
      <approved type="boolean">false</approved>
      <replies-count type="integer">0</replies-count>
      <bonus-time type="datetime">2000-01-01 08:28:00</bonus-time>
      <written-on type="datetime">2003-07-16 09:28:00</written-on>
      <content>Have a nice day</content>
      <author-email-address>david@loudthinking.com</author-email-address>
      <parent-id></parent-id>
      <last-read type="date">2004-04-15</last-read>
    </topic>

  ...and you can configure with:

    topic.to_xml(:skip_instruct => true, :except => [ :id, bonus_time, :written_on, replies_count ])

  ...that'll return:

    <topic>
      <title>The First Topic</title>
      <author-name>David</author-name>
      <approved type="boolean">false</approved>
      <content>Have a nice day</content>
      <author-email-address>david@loudthinking.com</author-email-address>
      <parent-id></parent-id>
      <last-read type="date">2004-04-15</last-read>
    </topic>

  You can even do load first-level associations as part of the document:

    firm.to_xml :include => [ :account, :clients ]

  ...that'll return something like:

    <?xml version="1.0" encoding="UTF-8"?>
    <firm>
      <id type="integer">1</id>
      <rating type="integer">1</rating>
      <name>37signals</name>
      <clients>
        <client>
          <rating type="integer">1</rating>
          <name>Summit</name>
        </client>
        <client>
          <rating type="integer">1</rating>
          <name>Microsoft</name>
        </client>
      </clients>
      <account>
        <id type="integer">1</id>
        <credit-limit type="integer">50</credit-limit>
      </account>
    </firm>  

* Allow :counter_cache to take a column name for custom counter cache columns [Jamis Buck]

* Documentation fixes for :dependent [robby@planetargon.com]

* Stop the MySQL adapter crashing when views are present. #3782 [Jonathan Viney]

* Don't classify the belongs_to class, it is already singular #4117 [keithm@infused.org]

* Allow set_fixture_class to take Classes instead of strings for a class in a module.  Raise FixtureClassNotFound if a fixture can't load.  [Rick Olson]

* Fix quoting of inheritance column for STI eager loading #4098 [Jonathan Viney <jonathan@bluewire.net.nz>]

* Added smarter table aliasing for eager associations for multiple self joins #3580 [Rick Olson]

    * The first time a table is referenced in a join, no alias is used.
    * After that, the parent class name and the reflection name are used.

        Tree.find(:all, :include => :children) # LEFT OUTER JOIN trees AS tree_children ...

    * Any additional join references get a numerical suffix like '_2', '_3', etc.

* Fixed eager loading problems with single-table inheritance #3580 [Rick Olson]. Post.find(:all, :include => :special_comments) now returns all posts, and any special comments that the posts may have. And made STI work with has_many :through and polymorphic belongs_to.

* Added cascading eager loading that allows for queries like Author.find(:all, :include=> { :posts=> :comments }), which will fetch all authors, their posts, and the comments belonging to those posts in a single query (using LEFT OUTER JOIN) #3913 [anna@wota.jp]. Examples:

    # cascaded in two levels
    >> Author.find(:all, :include=>{:posts=>:comments})
    => authors
         +- posts
              +- comments

    # cascaded in two levels and normal association
    >> Author.find(:all, :include=>[{:posts=>:comments}, :categorizations])
    => authors
         +- posts
              +- comments
         +- categorizations

    # cascaded in two levels with two has_many associations
    >> Author.find(:all, :include=>{:posts=>[:comments, :categorizations]})
    => authors
         +- posts
              +- comments
              +- categorizations

    # cascaded in three levels
    >> Company.find(:all, :include=>{:groups=>{:members=>{:favorites}}})
    => companies
         +- groups
              +- members
                   +- favorites

* Make counter cache work when replacing an association #3245 [eugenol@gmail.com]

* Make migrations verbose [Jamis Buck]

* Make counter_cache work with polymorphic belongs_to [Jamis Buck]

* Fixed that calling HasOneProxy#build_model repeatedly would cause saving to happen #4058 [anna@wota.jp]

* Added Sybase database adapter that relies on the Sybase Open Client bindings (see http://raa.ruby-lang.org/project/sybase-ctlib) #3765 [John Sheets]. It's almost completely Active Record compliant (including migrations), but has the following caveats:

    * Does not support DATE SQL column types; use DATETIME instead.
    * Date columns on HABTM join tables are returned as String, not Time.
    * Insertions are potentially broken for :polymorphic join tables
    * BLOB column access not yet fully supported

* Clear stale, cached connections left behind by defunct threads. [Jeremy Kemper]

* CHANGED DEFAULT: set ActiveRecord::Base.allow_concurrency to false.  Most AR usage is in single-threaded applications. [Jeremy Kemper]

2188
* Renamed the "oci" adapter to "oracle", but kept the old name as an alias #4017 [Michael Schoen]
2189

2190
* Fixed that Base.save should always return false if the save didn't succeed, including if it has halted by before_save's #1861, #2477 [David Heinemeier Hansson]
2191 2192 2193 2194 2195 2196 2197

* Speed up class -> connection caching and stale connection verification.  #3979 [Stefan Kaes]

* Add set_fixture_class to allow the use of table name accessors with models which use set_table_name. [Kevin Clark]

* Added that fixtures to placed in subdirectories of the main fixture files are also loaded #3937 [dblack@wobblini.net]

2198
* Define attribute query methods to avoid method_missing calls. #3677 [Jonathan Viney]
2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221

* ActiveRecord::Base.remove_connection explicitly closes database connections and doesn't corrupt the connection cache. Introducing the disconnect! instance method for the PostgreSQL, MySQL, and SQL Server adapters; implementations for the others are welcome.  #3591 [Simon Stapleton, Tom Ward]

* Added support for nested scopes #3407 [anna@wota.jp]. Examples:

    Developer.with_scope(:find => { :conditions => "salary > 10000", :limit => 10 }) do
      Developer.find(:all)     # => SELECT * FROM developers WHERE (salary > 10000) LIMIT 10

      # inner rule is used. (all previous parameters are ignored)
      Developer.with_exclusive_scope(:find => { :conditions => "name = 'Jamis'" }) do
        Developer.find(:all)   # => SELECT * FROM developers WHERE (name = 'Jamis')
      end

      # parameters are merged
      Developer.with_scope(:find => { :conditions => "name = 'Jamis'" }) do
        Developer.find(:all)   # => SELECT * FROM developers WHERE (( salary > 10000 ) AND ( name = 'Jamis' )) LIMIT 10
      end
    end

* Fixed db2 connection with empty user_name and auth options #3622 [phurley@gmail.com]

* Fixed validates_length_of to work on UTF-8 strings by using characters instead of bytes #3699 [Masao Mutoh]

2222
* Fixed that reflections would bleed across class boundaries in single-table inheritance setups #3796 [Lars Pind]
2223 2224 2225 2226 2227 2228 2229 2230

* Added calculations: Base.count, Base.average, Base.sum, Base.minimum, Base.maxmium, and the generic Base.calculate. All can be used with :group and :having. Calculations and statitics need no longer require custom SQL. #3958 [Rick Olson]. Examples:

    Person.average :age
    Person.minimum :age
    Person.maximum :age
    Person.sum :salary, :group => :last_name

2231
* Renamed Errors#count to Errors#size but kept an alias for the old name (and included an alias for length too) #3920 [Luke Redpath]
2232 2233 2234 2235 2236 2237 2238

* Reflections don't attempt to resolve module nesting of association classes. Simplify type computation. [Jeremy Kemper]

* Improved the Oracle OCI Adapter with better performance for column reflection (from #3210), fixes to migrations (from #3476 and #3742), tweaks to unit tests (from #3610), and improved documentation (from #2446) #3879 [Aggregated by schoenm@earthlink.net]

* Fixed that the schema_info table used by ActiveRecord::Schema.define should respect table pre- and suffixes #3834 [rubyonrails@atyp.de]

2239
* Added :select option to Base.count that'll allow you to select something else than * to be counted on. Especially important for count queries using DISTINCT #3839 [Stefan Kaes]
2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254

* Correct syntax error in mysql DDL,  and make AAACreateTablesTest run first [Bob Silva]

* Allow :include to be used with has_many :through associations #3611 [Michael Schoen]

* PostgreSQL: smarter schema dumps using pk_and_sequence_for(table).  #2920 [Blair Zajac]

* SQLServer: more compatible limit/offset emulation.  #3779 [Tom Ward]

* Polymorphic join support for has_one associations (has_one :foo, :as => :bar)  #3785 [Rick Olson]

* PostgreSQL: correctly parse negative integer column defaults.  #3776 [bellis@deepthought.org]

* Fix problems with count when used with :include [Jeremy Hopple and Kevin Clark]

2255
* ActiveRecord::RecordInvalid now states which validations failed in its default error message [Tobias Lütke]
2256

2257
* Using AssociationCollection#build with arrays of hashes should call build, not create [David Heinemeier Hansson]
2258 2259 2260 2261 2262

* Remove definition of reloadable? from ActiveRecord::Base to make way for new Reloadable code. [Nicholas Seckar]

* Fixed schema handling for DB2 adapter that didn't work: an initial schema could be set, but it wasn't used when getting tables and indexes #3678 [Maik Schmidt]

2263
* Support the :column option for remove_index with the PostgreSQL adapter. #3661 [Shugo Maeda]
2264 2265 2266

* Add documentation for add_index and remove_index. #3600 [Manfred Stienstra <m.stienstra@fngtps.com>]

2267
* If the OCI library is not available, raise an exception indicating as much. #3593 [Michael Schoen]
2268 2269 2270 2271 2272 2273 2274

* Add explicit :order in finder tests as postgresql orders results differently by default. #3577. [Rick Olson]

* Make dynamic finders honor additional passed in :conditions. #3569 [Oleg Pudeyev <pudeyo@rpi.edu>, Marcel Molina Jr.]

* Show a meaningful error when the DB2 adapter cannot be loaded due to missing dependencies. [Nicholas Seckar]

2275
* Make .count work for has_many associations with multi line finder sql [Michael Schoen]
2276 2277 2278 2279 2280 2281 2282

* Add AR::Base.base_class for querying the ancestor AR::Base subclass [Jamis Buck]

* Allow configuration of the column used for optimistic locking [wilsonb@gmail.com]

* Don't hardcode 'id' in acts as list.  [ror@philippeapril.com]

2283
* Fix date errors for SQLServer in association tests. #3406 [Kevin Clark]
2284 2285 2286

* Escape database name in MySQL adapter when creating and dropping databases. #3409 [anna@wota.jp]

2287
* Disambiguate table names for columns in validates_uniqueness_of's WHERE clause. #3423 [alex.borovsky@gmail.com]
2288

2289
* .with_scope imposed create parameters now bypass attr_protected [Tobias Lütke]
2290 2291 2292 2293 2294 2295 2296

* Don't raise an exception when there are more keys than there are named bind variables when sanitizing conditions. [Marcel Molina Jr.]

* Multiple enhancements and adjustments to DB2 adaptor. #3377 [contact@maik-schmidt.de]

* Sanitize scoped conditions. [Marcel Molina Jr.]

2297
* Added option to Base.reflection_of_all_associations to specify a specific association to scope the call. For example Base.reflection_of_all_associations(:has_many) [David Heinemeier Hansson]
2298

2299
* Added ActiveRecord::SchemaDumper.ignore_tables which tells SchemaDumper which tables to ignore. Useful for tables with funky column like the ones required for tsearch2. [Tobias Lütke]
2300

2301
* SchemaDumper now doesn't fail anymore when there are unknown column types in the schema. Instead the table is ignored and a Comment is left in the schema.rb. [Tobias Lütke]
2302 2303 2304 2305 2306

* Fixed that saving a model with multiple habtm associations would only save the first one.  #3244 [yanowitz-rubyonrails@quantumfoam.org, Florian Weber]

* Fix change_column to work with PostgreSQL 7.x and 8.x.  #3141 [wejn@box.cz, Rick Olson, Scott Barron] 

2307
* removed :piggyback in favor of just allowing :select on :through associations. [Tobias Lütke] 
2308

2309
* made method missing delegation to class methods on relation target work on :through associations. [Tobias Lütke] 
2310

2311
* made .find() work on :through relations. [Tobias Lütke] 
2312 2313 2314

* Fix typo in association docs. #3296. [Blair Zajac]

2315
* Fixed :through relations when using STI inherited classes would use the inherited class's name as foreign key on the join model [Tobias Lütke] 
2316 2317 2318 2319 2320 2321 2322

*1.13.2* (December 13th, 2005)

* Become part of Rails 1.0

* MySQL: allow encoding option for mysql.rb driver.  [Jeremy Kemper]

2323
* Added option inheritance for find calls on has_and_belongs_to_many and has_many assosociations [David Heinemeier Hansson]. Example:
2324 2325 2326 2327 2328 2329 2330 2331 2332

    class Post
      has_many :recent_comments, :class_name => "Comment", :limit => 10, :include => :author
    end

    post.recent_comments.find(:all) # Uses LIMIT 10 and includes authors
    post.recent_comments.find(:all, :limit => nil) # Uses no limit but include authors
    post.recent_comments.find(:all, :limit => nil, :include => nil) # Uses no limit and doesn't include authors

2333
* Added option to specify :group, :limit, :offset, and :select options from find on has_and_belongs_to_many and has_many assosociations [David Heinemeier Hansson]
2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350

* MySQL: fixes for the bundled mysql.rb driver.  #3160 [Justin Forder]

* SQLServer: fix obscure optimistic locking bug.  #3068 [kajism@yahoo.com]

* SQLServer: support uniqueidentifier columns.  #2930 [keithm@infused.org]

* SQLServer: cope with tables names qualified by owner.  #3067 [jeff@ministrycentered.com]

* SQLServer: cope with columns with "desc" in the name.  #1950 [Ron Lusk, Ryan Tomayko]

* SQLServer: cope with primary keys with "select" in the name.  #3057 [rdifrango@captechventures.com]

* Oracle: active? performs a select instead of a commit.  #3133 [Michael Schoen]

* MySQL: more robust test for nullified result hashes.  #3124 [Stefan Kaes]

2351
* Reloading an instance refreshes its aggregations as well as its associations.  #3024 [François Beausoleil]
2352 2353 2354 2355 2356 2357 2358 2359 2360

* Fixed that using :include together with :conditions array in Base.find would cause NoMethodError #2887 [Paul Hammmond]

* PostgreSQL: more robust sequence name discovery.  #3087 [Rick Olson]

* Oracle: use syntax compatible with Oracle 8.  #3131 [Michael Schoen]

* MySQL: work around ruby-mysql/mysql-ruby inconsistency with mysql.stat.  Eliminate usage of mysql.ping because it doesn't guarantee reconnect.  Explicitly close and reopen the connection instead.  [Jeremy Kemper]

2361
* Added preliminary support for polymorphic associations [David Heinemeier Hansson]
2362

2363
* Added preliminary support for join models [David Heinemeier Hansson]
2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388

* Allow validate_uniqueness_of to be scoped by more than just one column.  #1559. [jeremy@jthopple.com, Marcel Molina Jr.]

* Firebird: active? and reconnect! methods for handling stale connections.  #428 [Ken Kunz <kennethkunz@gmail.com>]

* Firebird: updated for FireRuby 0.4.0.  #3009 [Ken Kunz <kennethkunz@gmail.com>]

* MySQL and PostgreSQL: active? compatibility with the pure-Ruby driver.  #428 [Jeremy Kemper]

* Oracle: active? check pings the database rather than testing the last command status.  #428 [Michael Schoen]

* SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find.  #2974 [kajism@yahoo.com]

* Reloading a model doesn't lose track of its connection.  #2996 [junk@miriamtech.com, Jeremy Kemper]

* Fixed bug where using update_attribute after pushing a record to a habtm association of the object caused duplicate rows in the join table. #2888 [colman@rominato.com, Florian Weber, Michael Schoen]

* MySQL, PostgreSQL: reconnect! also reconfigures the connection.  Otherwise, the connection 'loses' its settings if it times out and is reconnected.  #2978 [Shugo Maeda]

* has_and_belongs_to_many: use JOIN instead of LEFT JOIN.  [Jeremy Kemper]

* MySQL: introduce :encoding option to specify the character set for client, connection, and results.  Only available for MySQL 4.1 and later with the mysql-ruby driver.  Do SHOW CHARACTER SET in mysql client to see available encodings.  #2975 [Shugo Maeda]

* Add tasks to create, drop and rebuild the MySQL and PostgreSQL test  databases. [Marcel Molina Jr.]

2389
* Correct boolean handling in generated reader methods.  #2945 [Don Park, Stefan Kaes]
2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436

* Don't generate read methods for columns whose names are not valid ruby method names.  #2946 [Stefan Kaes]

* Document :force option to create_table.  #2921 [Blair Zajac <blair@orcaware.com>]

* Don't add the same conditions twice in has_one finder sql.  #2916 [Jeremy Evans]

* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]

* Introducing the Firebird adapter.  Quote columns and use attribute_condition more consistently.  Setup guide: http://wiki.rubyonrails.com/rails/pages/Firebird+Adapter  #1874 [Ken Kunz <kennethkunz@gmail.com>]

* SQLServer: active? and reconnect! methods for handling stale connections.  #428 [kajism@yahoo.com, Tom Ward <tom@popdog.net>]

* Associations handle case-equality more consistently: item.parts.is_a?(Array) and item.parts === Array.  #1345 [MarkusQ@reality.com]

* SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY.  #2866 [kajism@yahoo.com, Tom Ward <tom@popdog.net>]

* Oracle: active? and reconnect! methods for handling stale connections.  Optionally retry queries after reconnect.  #428 [Michael Schoen <schoenm@earthlink.net>]

* Correct documentation for Base.delete_all.  #1568 [Newhydra]

* Oracle: test case for column default parsing.  #2788 [Michael Schoen <schoenm@earthlink.net>]

* Update documentation for Migrations.  #2861 [Tom Werner <tom@cube6media.com>]

* When AbstractAdapter#log rescues an exception, attempt to detect and reconnect to an inactive database connection.  Connection adapter must respond to the active? and reconnect! instance methods.  Initial support for PostgreSQL, MySQL, and SQLite.  Make certain that all statements which may need reconnection are performed within a logged block: for example, this means no avoiding log(sql, name) { } if @logger.nil?  #428 [Jeremy Kemper]

* Oracle: Much faster column reflection.  #2848 [Michael Schoen <schoenm@earthlink.net>]

* Base.reset_sequence_name analogous to reset_table_name (mostly useful for testing).  Base.define_attr_method allows nil values.  [Jeremy Kemper]

* PostgreSQL: smarter sequence name defaults, stricter last_insert_id, warn on pk without sequence.  [Jeremy Kemper]

* PostgreSQL: correctly discover custom primary key sequences.  #2594 [Blair Zajac <blair@orcaware.com>, meadow.nnick@gmail.com, Jeremy Kemper]

* SQLServer: don't report limits for unsupported field types.  #2835 [Ryan Tomayko]

* Include the Enumerable module in ActiveRecord::Errors.  [Rick Bradley <rick@rickbradley.com>]

* Add :group option, correspond to GROUP BY, to the find method and to the has_many association.  #2818 [rubyonrails@atyp.de]

* Don't cast nil or empty strings to a dummy date.  #2789 [Rick Bradley <rick@rickbradley.com>]

* acts_as_list plays nicely with inheritance by remembering the class which declared it.  #2811 [rephorm@rephorm.com]

* Fix sqlite adaptor's detection of missing dbfile or database declaration. [Nicholas Seckar]

2437
* Fixed acts_as_list for definitions without an explicit :order #2803 [Jonathan Viney]
2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455

* Upgrade bundled ruby-mysql 0.2.4 with mysql411 shim (see #440) to ruby-mysql 0.2.6 with a patchset for 4.1 protocol support.  Local change [301] is now a part of the main driver; reapplied local change [2182].  Removed GC.start from Result.free.  [tommy@tmtm.org, akuroda@gmail.com, Doug Fales <doug.fales@gmail.com>, Jeremy Kemper]

* Correct handling of complex order clauses with SQL Server limit emulation.  #2770 [Tom Ward <tom@popdog.net>, Matt B.]

* Correct whitespace problem in Oracle default column value parsing.  #2788 [rick@rickbradley.com]

* Destroy associated has_and_belongs_to_many records after all before_destroy callbacks but before destroy.  This allows you to act on the habtm association as you please while preserving referential integrity.  #2065 [larrywilliams1@gmail.com, sam.kirchmeier@gmail.com, elliot@townx.org, Jeremy Kemper]

* Deprecate the old, confusing :exclusively_dependent option in favor of :dependent => :delete_all.  [Jeremy Kemper]

* More compatible Oracle column reflection.  #2771 [Ryan Davis <ryand-ruby@zenspider.com>, Michael Schoen <schoenm@earthlink.net>]


*1.13.0* (November 7th, 2005)

* Fixed faulty regex in get_table_name method (SQLServerAdapter) #2639 [Ryan Tomayko]

2456
* Added :include as an option for association declarations [David Heinemeier Hansson]. Example:
2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470

    has_many :posts, :include => [ :author, :comments ]

* Rename Base.constrain to Base.with_scope so it doesn't conflict with existing concept of database constraints.  Make scoping more robust: uniform method => parameters, validated method names and supported finder parameters, raise exception on nested scopes.  [Jeremy Kemper]  Example:

    Comment.with_scope(:find => { :conditions => 'active=true' }, :create => { :post_id => 5 }) do
      # Find where name = ? and active=true
      Comment.find :all, :conditions => ['name = ?', name]
      # Create comment associated with :post_id
      Comment.create :body => "Hello world"
    end

* Fixed that SQL Server should ignore :size declarations on anything but integer and string in the agnostic schema representation #2756 [Ryan Tomayko]

2471
* Added constrain scoping for creates using a hash of attributes bound to the :creation key [David Heinemeier Hansson]. Example:
2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482

    Comment.constrain(:creation => { :post_id => 5 }) do
      # Associated with :post_id
      Comment.create :body => "Hello world"
    end

  This is rarely used directly, but allows for find_or_create on associations. So you can do:

    # If the tag doesn't exist, a new one is created that's associated with the person
    person.tags.find_or_create_by_name("Summer")

2483
* Added find_or_create_by_X as a second type of dynamic finder that'll create the record if it doesn't already exist [David Heinemeier Hansson]. Example:
2484 2485 2486 2487 2488 2489 2490

    # No 'Summer' tag exists
    Tag.find_or_create_by_name("Summer") # equal to Tag.create(:name => "Summer")

    # Now the 'Summer' tag does exist
    Tag.find_or_create_by_name("Summer") # equal to Tag.find_by_name("Summer")

2491
* Added extension capabilities to has_many and has_and_belongs_to_many proxies [David Heinemeier Hansson]. Example:
2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509

    class Account < ActiveRecord::Base
      has_many :people do
        def find_or_create_by_name(name)
          first_name, *last_name = name.split
          last_name = last_name.join " "

          find_or_create_by_first_name_and_last_name(first_name, last_name)
        end
      end
    end

    person = Account.find(:first).people.find_or_create_by_name("David Heinemeier Hansson")
    person.first_name # => "David"
    person.last_name  # => "Heinemeier Hansson"

  Note that the anoymous module must be declared using brackets, not do/end (due to order of evaluation).

2510
* Omit internal dtproperties table from SQLServer table list.  #2729 [Ryan Tomayko]
2511

2512
* Quote column names in generated SQL.  #2728 [Ryan Tomayko]
2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525

* Correct the pure-Ruby MySQL 4.1.1 shim's version test.  #2718 [Jeremy Kemper]

* Add Model.create! to match existing model.save! method.  When save! raises RecordInvalid, you can catch the exception, retrieve the invalid record (invalid_exception.record), and see its errors (invalid_exception.record.errors).  [Jeremy Kemper]

* Correct fixture behavior when table name pluralization is off.  #2719 [Rick Bradley <rick@rickbradley.com>]

* Changed :dbfile to :database for SQLite adapter for consistency (old key still works as an alias) #2644 [Dan Peterson]

* Added migration support for Oracle #2647 [Michael Schoen]

* Worked around that connection can't be reset if allow_concurrency is off.  #2648 [Michael Schoen <schoenm@earthlink.net>]

2526
* Fixed SQL Server adapter to pass even more tests and do even better #2634 [Ryan Tomayko]
2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538

* Fixed SQL Server adapter so it honors options[:conditions] when applying :limits #1978 [Tom Ward]

* Added migration support to SQL Server adapter (please someone do the same for Oracle and DB2) #2625 [Tom Ward]

* Use AR::Base.silence rather than AR::Base.logger.silence in fixtures to preserve Log4r compatibility.  #2618 [dansketcher@gmail.com]

* Constraints are cloned so they can't be inadvertently modified while they're
in effect.  Added :readonly finder constraint.  Calling an association collection's class method (Part.foobar via item.parts.foobar) constrains :readonly => false since the collection's :joins constraint would otherwise force it to true.  [Jeremy Kemper <rails@bitsweat.net>]

* Added :offset and :limit to the kinds of options that Base.constrain can use #2466 [duane.johnson@gmail.com]

2539
* Fixed handling of nil number columns on Oracle and cleaned up tests for Oracle in general #2555 [Michael Schoen]
2540 2541 2542 2543 2544 2545

* Added quoted_true and quoted_false methods and tables to db2_adapter and cleaned up tests for DB2 #2493, #2624 [maik schmidt]


*1.12.2* (October 26th, 2005)

2546
* Allow symbols to rename columns when using SQLite adapter. #2531 [Kevin Clark]
2547 2548 2549

* Map Active Record time to SQL TIME.  #2575, #2576 [Robby Russell <robby@planetargon.com>]

2550
* Clarify semantics of ActiveRecord::Base#respond_to?  #2560 [Stefan Kaes]
2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603

* Fixed Association#clear for associations which have not yet been accessed. #2524 [Patrick Lenz <patrick@lenz.sh>]

* HABTM finders shouldn't return readonly records.  #2525 [Patrick Lenz <patrick@lenz.sh>]

* Make all tests runnable on their own. #2521. [Blair Zajac <blair@orcaware.com>]


*1.12.1* (October 19th, 2005)

* Always parenthesize :conditions options so they may be safely combined with STI and constraints.

* Correct PostgreSQL primary key sequence detection.  #2507 [tmornini@infomania.com]

* Added support for using limits in eager loads that involve has_many and has_and_belongs_to_many associations


*1.12.0* (October 16th, 2005)

* Update/clean up documentation (rdoc)

* PostgreSQL sequence support.  Use set_sequence_name in your model class to specify its primary key sequence.  #2292 [Rick Olson <technoweenie@gmail.com>, Robby Russell <robby@planetargon.com>]

* Change default logging colors to work on both white and black backgrounds. [Sam Stephenson]

* YAML fixtures support ordered hashes for fixtures with foreign key dependencies in the same table.  #1896 [purestorm@ggnore.net]

* :dependent now accepts :nullify option. Sets the foreign key of the related objects to NULL instead of deleting them. #2015 [Robby Russell <robby@planetargon.com>] 

* Introduce read-only records.  If you call object.readonly! then it will mark the object as read-only and raise ReadOnlyRecord if you call object.save.  object.readonly? reports whether the object is read-only.  Passing :readonly => true to any finder method will mark returned records as read-only.  The :joins option now implies :readonly, so if you use this option, saving the same record will now fail.  Use find_by_sql to work around.

* Avoid memleak in dev mode when using fcgi

* Simplified .clear on active record associations by using the existing delete_records method. #1906 [Caleb <me@cpb.ca>]

* Delegate access to a customized primary key to the conventional id method. #2444. [Blair Zajac <blair@orcaware.com>]

* Fix errors caused by assigning a has-one or belongs-to property to itself

* Add ActiveRecord::Base.schema_format setting which specifies how databases should be dumped [Sam Stephenson]

* Update DB2 adapter. #2206. [contact@maik-schmidt.de]

* Corrections to SQLServer native data types. #2267.  [rails.20.clarry@spamgourmet.com]

* Deprecated ActiveRecord::Base.threaded_connection in favor of ActiveRecord::Base.allow_concurrency.

* Protect id attribute from mass assigment even when the primary key is set to something else. #2438. [Blair Zajac <blair@orcaware.com>]

* Misc doc fixes (typos/grammar/etc.). #2430. [coffee2code]

* Add test coverage for content_columns. #2432. [coffee2code]

2604
* Speed up for unthreaded environments. #2431. [Stefan Kaes]
2605

2606
* Optimization for Mysql selects using mysql-ruby extension greater than 2.6.3.  #2426. [Stefan Kaes]
2607

2608
* Speed up the setting of table_name. #2428. [Stefan Kaes]
2609

2610
* Optimize instantiation of STI subclass records. In partial fullfilment of #1236. [Stefan Kaes]
2611 2612 2613

* Fix typo of 'constrains' to 'contraints'. #2069. [Michael Schuerig <michael@schuerig.de>]

2614
* Optimization refactoring for add_limit_offset!. In partial fullfilment of #1236. [Stefan Kaes]
2615 2616 2617

* Add ability to get all siblings, including the current child, with acts_as_tree. Recloses #2140. [Michael Schuerig <michael@schuerig.de>]

2618
* Add geometric type for postgresql adapter. #2233 [Andrew Kaspick]
2619

2620
* Add option (true by default) to generate reader methods for each attribute of a record to avoid the overhead of calling method missing. In partial fullfilment of #1236. [Stefan Kaes]
2621

2622
* Add convenience predicate methods on Column class. In partial fullfilment of #1236. [Stefan Kaes]
2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646

* Raise errors when invalid hash keys are passed to ActiveRecord::Base.find. #2363  [Chad Fowler <chad@chadfowler.com>, Nicholas Seckar]

* Added :force option to create_table that'll try to drop the table if it already exists before creating

* Fix transactions so that calling return while inside a transaction will not leave an open transaction on the connection. [Nicholas Seckar]

* Use foreign_key inflection uniformly.  #2156 [Blair Zajac <blair@orcaware.com>]

* model.association.clear should destroy associated objects if :dependent => true instead of nullifying their foreign keys.  #2221 [joergd@pobox.com, ObieFernandez <obiefernandez@gmail.com>]

* Returning false from before_destroy should cancel the action.  #1829 [Jeremy Huffman]

* Recognize PostgreSQL NOW() default as equivalent to CURRENT_TIMESTAMP or CURRENT_DATE, depending on the column's type.  #2256 [mat <mat@absolight.fr>]

* Extensive documentation for the abstract database adapter.  #2250 [François Beausoleil <fbeausoleil@ftml.net>]

* Clean up Fixtures.reset_sequences for PostgreSQL.  Handle tables with no rows and models with custom primary keys.  #2174, #2183 [jay@jay.fm, Blair Zajac <blair@orcaware.com>]

* Improve error message when nil is assigned to an attr which validates_size_of within a range.  #2022 [Manuel Holtgrewe <purestorm@ggnore.net>]

* Make update_attribute use the same writer method that update_attributes uses.
 #2237 [trevor@protocool.com]

2647
* Make migrations honor table name prefixes and suffixes. #2298 [Jakob Skjerning, Marcel Molina Jr.]
2648 2649 2650 2651 2652 2653 2654

* Correct and optimize PostgreSQL bytea escaping.  #1745, #1837 [dave@cherryville.org, ken@miriamtech.com, bellis@deepthought.org]

* Fixtures should only reset a PostgreSQL sequence if it corresponds to an integer primary key named id.  #1749 [chris@chrisbrinker.com]

* Standardize the interpretation of boolean columns in the Mysql and Sqlite adapters. (Use MysqlAdapter.emulate_booleans = false to disable this behavior)

2655
* Added new symbol-driven approach to activating observers with Base#observers= [David Heinemeier Hansson]. Example:
2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670

    ActiveRecord::Base.observers = :cacher, :garbage_collector

* Added AbstractAdapter#select_value and AbstractAdapter#select_values as convenience methods for selecting single values, instead of hashes, of the first column in a SELECT #2283 [solo@gatelys.com]

* Wrap :conditions in parentheses to prevent problems with OR's #1871 [Jamis Buck]

* Allow the postgresql adapter to work with the SchemaDumper. [Jamis Buck]

* Add ActiveRecord::SchemaDumper for dumping a DB schema to a pure-ruby file, making it easier to consolidate large migration lists and port database schemas between databases. [Jamis Buck]

* Fixed migrations for Windows when using more than 10 [David Naseby]

* Fixed that the create_x method from belongs_to wouldn't save the association properly #2042 [Florian Weber]

2671
* Fixed saving a record with two unsaved belongs_to associations pointing to the same object #2023 [Tobias Lütke]
2672 2673 2674 2675 2676

* Improved migrations' behavior when the schema_info table is empty. [Nicholas Seckar]

* Fixed that Observers didn't observe sub-classes #627 [Florian Weber]

2677
* Fix eager loading error messages, allow :include to specify tables using strings or symbols. Closes #2222 [Marcel Molina Jr.]
2678 2679 2680 2681 2682

* Added check for RAILS_CONNECTION_ADAPTERS on startup and only load the connection adapters specified within if its present (available in Rails through config.connection_adapters using the new config) #1958 [skae]

* Fixed various problems with has_and_belongs_to_many when using customer finder_sql #2094 [Florian Weber]

2683
* Added better exception error when unknown column types are used with migrations #1814 [François Beausoleil]
2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698

* Fixed "connection lost" issue with the bundled Ruby/MySQL driver (would kill the app after 8 hours of inactivity) #2163, #428 [kajism@yahoo.com]

* Fixed comparison of Active Record objects so two new objects are not equal #2099 [deberg]

* Fixed that the SQL Server adapter would sometimes return DBI::Timestamp objects instead of Time #2127 [Tom Ward]

* Added the instance methods #root and #ancestors on acts_as_tree and fixed siblings to not include the current node #2142, #2140 [coffee2code]

* Fixed that Active Record would call SHOW FIELDS twice (or more) for the same model when the cached results were available #1947 [sd@notso.net]

* Added log_level and use_silence parameter to ActiveRecord::Base.benchmark. The first controls at what level the benchmark statement will be logged (now as debug, instead of info) and the second that can be passed false to include all logging statements during the benchmark block/

* Make sure the schema_info table is created before querying the current version #1903

2699
* Fixtures ignore table name prefix and suffix #1987 [Jakob Skjerning]
2700

2701
* Add documentation for index_type argument to add_index method for migrations #2005 [Blaine]
2702 2703 2704

* Modify read_attribute to allow a symbol argument #2024 [Ken Kunz]

2705
* Make destroy return self #1913 [Sebastian Kanthak]
2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726

* Fix typo in validations documentation #1938 [court3nay]

* Make acts_as_list work for insert_at(1) #1966 [hensleyl@papermountain.org]

* Fix typo in count_by_sql documentation #1969 [Alexey Verkhovsky]

* Allow add_column and create_table to specify NOT NULL #1712 [emptysands@gmail.com]

* Fix create_table so that id column is implicitly added [Rick Olson]

* Default sequence names for Oracle changed to #{table_name}_seq, which is the most commonly used standard. In addition, a new method ActiveRecord::Base#set_sequence_name allows the developer to set the sequence name per model. This is a non-backwards-compatible change -- anyone using the old-style "rails_sequence" will need to either create new sequences, or set: ActiveRecord::Base.set_sequence_name = "rails_sequence" #1798

* OCIAdapter now properly handles synonyms, which are commonly used to separate out the schema owner from the application user #1798

* Fixed the handling of camelCase columns names in Oracle #1798

* Implemented for OCI the Rakefile tasks of :clone_structure_to_test, :db_structure_dump, and :purge_test_database, which enable Oracle folks to enjoy all the agile goodness of Rails for testing. Note that the current implementation is fairly limited -- only tables and sequences are cloned, not constraints or indexes. A full clone in Oracle generally requires some manual effort, and is version-specific. Post 9i, Oracle recommends the use of the DBMS_METADATA package, though that approach requires editing of the physical characteristics generated #1798

* Fixed the handling of multiple blob columns in Oracle if one or more of them are null #1798

2727
* Added support for calling constrained class methods on has_many and has_and_belongs_to_many collections #1764 [Tobias Lütke]
2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758

    class Comment < AR:B
      def self.search(q)
        find(:all, :conditions => ["body = ?", q])
      end
    end 

    class Post < AR:B
      has_many :comments
    end

    Post.find(1).comments.search('hi') # => SELECT * from comments WHERE post_id = 1 AND body = 'hi'

  NOTICE: This patch changes the underlying SQL generated by has_and_belongs_to_many queries. If your relying on that, such as
  by explicitly referencing the old t and j aliases, you'll need to update your code. Of course, you _shouldn't_ be relying on
  details like that no less than you should be diving in to touch private variables. But just in case you do, consider yourself
  noticed :)

* Added migration support for SQLite (using temporary tables to simulate ALTER TABLE) #1771 [Sam Stephenson]

* Remove extra definition of supports_migrations? from abstract_adaptor.rb [Nicholas Seckar]

* Fix acts_as_list so that moving next-to-last item to the bottom does not result in duplicate item positions

* Fixed incompatibility in DB2 adapter with the new limit/offset approach #1718 [Maik Schmidt]

* Added :select option to find which can specify a different value than the default *, like find(:all, :select => "first_name, last_name"), if you either only want to select part of the columns or exclude columns otherwise included from a join #1338 [Stefan Kaes]


*1.11.1* (11 July, 2005)

2759
* Added support for limit and offset with eager loading of has_one and belongs_to associations. Using the options with has_many and has_and_belongs_to_many associations will now raise an ActiveRecord::ConfigurationError #1692 [Rick Olson]
2760 2761 2762 2763 2764

* Fixed that assume_bottom_position (in acts_as_list) could be called on items already last in the list and they would move one position away from the list #1648 [tyler@kianta.com]

* Added ActiveRecord::Base.threaded_connections flag to turn off 1-connection per thread (required for thread safety). By default it's on, but WEBrick in Rails need it off #1685 [Sam Stephenson]

2765
* Correct reflected table name for singular associations.  #1688 [court3nay]
2766 2767 2768 2769 2770

* Fixed optimistic locking with SQL Server #1660 [tom@popdog.net]

* Added ActiveRecord::Migrator.migrate that can figure out whether to go up or down based on the target version and the current

2771
* Added better error message for "packets out of order" #1630 [court3nay]
2772 2773 2774 2775 2776 2777 2778 2779 2780 2781

* Fixed first run of "rake migrate" on PostgreSQL by not expecting a return value on the id #1640


*1.11.0* (6 July, 2005)

* Fixed that Yaml error message in fixtures hid the real error #1623 [Nicholas Seckar]

* Changed logging of SQL statements to use the DEBUG level instead of INFO

2782
* Added new Migrations framework for describing schema transformations in a way that can be easily applied across multiple databases #1604 [Tobias Lütke] See documentation under ActiveRecord::Migration and the additional support in the Rails rakefile/generator.
2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804

* Added callback hooks to association collections #1549 [Florian Weber]. Example:

    class Project
      has_and_belongs_to_many :developers, :before_add => :evaluate_velocity

      def evaluate_velocity(developer)
        ...
      end
    end 

  ..raising an exception will cause the object not to be added (or removed, with before_remove).


* Fixed Base.content_columns call for SQL Server adapter #1450 [DeLynn Berry]

* Fixed Base#write_attribute to work with both symbols and strings #1190 [Paul Legato]

* Fixed that has_and_belongs_to_many didn't respect single table inheritance types #1081 [Florian Weber]

* Speed up ActiveRecord#method_missing for the common case (read_attribute).

2805
* Only notify observers on after_find and after_initialize if these methods are defined on the model.  #1235 [Stefan Kaes]
2806 2807 2808 2809 2810

* Fixed that single-table inheritance sub-classes couldn't be used to limit the result set with eager loading #1215 [Chris McGrath]

* Fixed validates_numericality_of to work with overrided getter-method when :allow_nil is on #1316 [raidel@onemail.at]

2811
* Added roots, root, and siblings to the batch of methods added by acts_as_tree #1541 [Michael Schuerig]
2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832

* Added support for limit/offset with the MS SQL Server driver so that pagination will now work #1569 [DeLynn Berry]

* Added support for ODBC connections to MS SQL Server so you can connect from a non-Windows machine #1569 [Mark Imbriaco/DeLynn Berry]

* Fixed that multiparameter posts ignored attr_protected #1532 [alec+rails@veryclever.net]

* Fixed problem with eager loading when using a has_and_belongs_to_many association using :association_foreign_key #1504 [flash@vanklinkenbergsoftware.nl]

* Fixed Base#find to honor the documentation on how :joins work and make them consistent with Base#count #1405 [pritchie@gmail.com]. What used to be:

    Developer.find :all, :joins => 'developers_projects', :conditions => 'id=developer_id AND project_id=1'

  ...should instead be:

    Developer.find(
      :all, 
      :joins => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id', 
      :conditions => 'project_id=1'
    )    

2833
* Fixed that validations didn't respecting custom setting for too_short, too_long messages #1437 [Marcel Molina Jr.]
2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859

* Fixed that clear_association_cache doesn't delete new associations on new records (so you can safely place new records in the session with Action Pack without having new associations wiped) #1494 [cluon]

* Fixed that calling Model.find([]) returns [] and doesn't throw an exception #1379

* Fixed that adding a record to a has_and_belongs_to collection would always save it -- now it only saves if its a new record #1203 [Alisdair McDiarmid]

* Fixed saving of in-memory association structures to happen as a after_create/after_update callback instead of after_save -- that way you can add new associations in after_create/after_update callbacks without getting them saved twice

* Allow any Enumerable, not just Array, to work as bind variables #1344 [Jeremy Kemper]

* Added actual database-changing behavior to collection assigment for has_many and has_and_belongs_to_many #1425 [Sebastian Kanthak].
  Example:

    david.projects = [Project.find(1), Project.new("name" => "ActionWebSearch")]
    david.save

  If david.projects already contain the project with ID 1, this is left unchanged. Any other projects are dropped. And the new
  project is saved when david.save is called.

  Also included is a way to do assignments through IDs, which is perfect for checkbox updating, so you get to do:

    david.project_ids = [1, 5, 7]

* Corrected typo in find SQL for has_and_belongs_to_many.  #1312 [ben@bensinclair.com]

2860
* Fixed sanitized conditions for has_many finder method.  #1281 [jackc@hylesanderson.com, pragdave, Tobias Lütke]
2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917

* Comprehensive PostgreSQL schema support.  Use the optional schema_search_path directive in database.yml to give a comma-separated list of schemas to search for your tables.  This allows you, for example, to have tables in a shared schema without having to use a custom table name.  See http://www.postgresql.org/docs/8.0/interactive/ddl-schemas.html to learn more.  #827 [dave@cherryville.org]

* Corrected @@configurations typo #1410 [david@ruppconsulting.com]

* Return PostgreSQL columns in the order they were declared #1374 [perlguy@gmail.com]

* Allow before/after update hooks to work on models using optimistic locking 

* Eager loading of dependent has_one associations won't delete the association #1212

* Added a second parameter to the build and create method for has_one that controls whether the existing association should be replaced (which means nullifying its foreign key as well). By default this is true, but false can be passed to prevent it.

* Using transactional fixtures now causes the data to be loaded only once.

* Added fixture accessor methods that can be used when instantiated fixtures are disabled.

    fixtures :web_sites

    def test_something
      assert_equal "Ruby on Rails", web_sites(:rubyonrails).name
    end

* Added DoubleRenderError exception that'll be raised if render* is called twice #518 [Nicholas Seckar]

* Fixed exceptions occuring after render has been called #1096 [Nicholas Seckar]

* CHANGED: validates_presence_of now uses Errors#add_on_blank, which will make "  " fail the validation where it didn't before #1309

* Added Errors#add_on_blank which works like Errors#add_on_empty, but uses Object#blank? instead

* Added the :if option to all validations that can either use a block or a method pointer to determine whether the validation should be run or not. #1324 [Duane Johnson/jhosteny]. Examples:

  Conditional validations such as the following are made possible:
    validates_numericality_of :income, :if => :employed?

  Conditional validations can also solve the salted login generator problem:
    validates_confirmation_of :password, :if => :new_password?

  Using blocks:
    validates_presence_of :username, :if => Proc.new { |user| user.signup_step > 1 }

* Fixed use of construct_finder_sql when using :join #1288 [dwlt@dwlt.net]

* Fixed that :delete_sql in has_and_belongs_to_many associations couldn't access record properties #1299 [Rick Olson]

* Fixed that clone would break when an aggregate had the same name as one of its attributes #1307 [Jeremy Kemper]

* Changed that destroying an object will only freeze the attributes hash, which keeps the object from having attributes changed (as that wouldn't make sense), but allows for the querying of associations after it has been destroyed.

* Changed the callbacks such that observers are notified before the in-object callbacks are triggered. Without this change, it wasn't possible to act on the whole object in something like a before_destroy observer without having the objects own callbacks (like deleting associations) called first.

* Added option for passing an array to the find_all version of the dynamic finders and have it evaluated as an IN fragment. Example:

    # SELECT * FROM topics WHERE title IN ('First', 'Second')
    Topic.find_all_by_title(["First", "Second"])

2918
* Added compatibility with camelCase column names for dynamic finders #533 [Dee Zsombor]
2919

2920
* Fixed extraneous comma in count() function that made it not work with joins #1156 [Jarkko Laine/Dee Zsombor]
2921 2922 2923 2924 2925

* Fixed incompatibility with Base#find with an array of ids that would fail when using eager loading #1186 [Alisdair McDiarmid]

* Fixed that validate_length_of lost :on option when :within was specified #1195 [jhosteny@mac.com]

2926
* Added encoding and min_messages options for PostgreSQL #1205 [Shugo Maeda]. Configuration example:
2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983

    development:
      adapter: postgresql
      database: rails_development
      host: localhost
      username: postgres
      password:
      encoding: UTF8
      min_messages: ERROR

* Fixed acts_as_list where deleting an item that was removed from the list would ruin the positioning of other list items #1197 [Jamis Buck]

* Added validates_exclusion_of as a negative of validates_inclusion_of

* Optimized counting of has_many associations by setting the association to empty if the count is 0 so repeated calls doesn't trigger database calls


*1.10.1* (20th April, 2005)

* Fixed frivilous database queries being triggered with eager loading on empty associations and other things

* Fixed order of loading in eager associations

* Fixed stray comma when using eager loading and ordering together from has_many associations #1143


*1.10.0* (19th April, 2005)

* Added eager loading of associations as a way to solve the N+1 problem more gracefully without piggy-back queries. Example:

    for post in Post.find(:all, :limit => 100)
      puts "Post:            " + post.title
      puts "Written by:      " + post.author.name
      puts "Last comment on: " + post.comments.first.created_on
    end

  This used to generate 301 database queries if all 100 posts had both author and comments. It can now be written as:

    for post in Post.find(:all, :limit => 100, :include => [ :author, :comments ])

  ...and the number of database queries needed is now 1.

* Added new unified Base.find API and deprecated the use of find_first and find_all. See the documentation for Base.find. Examples:

    Person.find(1, :conditions => "administrator = 1", :order => "created_on DESC")
    Person.find(1, 5, 6, :conditions => "administrator = 1", :order => "created_on DESC")
    Person.find(:first, :order => "created_on DESC", :offset => 5)
    Person.find(:all, :conditions => [ "category IN (?)", categories], :limit => 50)
    Person.find(:all, :offset => 10, :limit => 10)

* Added acts_as_nested_set #1000 [wschenk]. Introduction:

    This acts provides Nested Set functionality.  Nested Set is similiar to Tree, but with
    the added feature that you can select the children and all of it's descendants with
    a single query.  A good use case for this is a threaded post system, where you want
    to display every reply to a comment without multiple selects.

2984
* Added Base.save! that attempts to save the record just like Base.save but will raise a RecordInvalid exception instead of returning false if the record is not valid [Dave Thomas]
2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013

* Fixed PostgreSQL usage of fixtures with regards to public schemas and table names with dots #962 [gnuman1@gmail.com]

* Fixed that fixtures were being deleted in the same order as inserts causing FK errors #890 [andrew.john.peters@gmail.com]

* Fixed loading of fixtures in to be in the right order (or PostgreSQL would bark) #1047 [stephenh@chase3000.com]

* Fixed page caching for non-vhost applications living underneath the root #1004 [Ben Schumacher]

* Fixes a problem with the SQL Adapter which was resulting in IDENTITY_INSERT not being set to ON when it should be #1104 [adelle]

* Added the option to specify the acceptance string in validates_acceptance_of #1106 [caleb@aei-tech.com]

* Added insert_at(position) to acts_as_list #1083 [DeLynnB]

* Removed the default order by id on has_and_belongs_to_many queries as it could kill performance on large sets (you can still specify by hand with :order)

* Fixed that Base.silence should restore the old logger level when done, not just set it to DEBUG #1084 [yon@milliped.com]

* Fixed boolean saving on Oracle #1093 [mparrish@pearware.org]

* Moved build_association and create_association for has_one and belongs_to out of deprecation as they work when the association is nil unlike association.build and association.create, which require the association to be already in place #864

* Added rollbacks of transactions if they're active as the dispatcher is killed gracefully (TERM signal) #1054 [Leon Bredt]

* Added quoting of column names for fixtures #997 [jcfischer@gmail.com]

* Fixed counter_sql when no records exist in database for PostgreSQL (would give error, not 0) #1039 [Caleb Tennis]

3014
* Fixed that benchmarking times for rendering included db runtimes #987 [Stefan Kaes]
3015 3016 3017 3018 3019 3020 3021

* Fixed boolean queries for t/f fields in PostgreSQL #995 [dave@cherryville.org]

* Added that model.items.delete(child) will delete the child, not just set the foreign key to nil, if the child is dependent on the model #978 [Jeremy Kemper]

* Fixed auto-stamping of dates (created_on/updated_on) for PostgreSQL #985 [dave@cherryville.org]

3022
* Fixed Base.silence/benchmark to only log if a logger has been configured #986 [Stefan Kaes]
3023

3024
* Added a join parameter as the third argument to Base.find_first and as the second to Base.count #426, #988 [Stefan Kaes]
3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109

* Fixed bug in Base#hash method that would treat records with the same string-based id as different [Dave Thomas]

* Renamed DateHelper#distance_of_time_in_words_to_now to DateHelper#time_ago_in_words (old method name is still available as a deprecated alias)


*1.9.1* (27th March, 2005)

* Fixed that Active Record objects with float attribute could not be cloned #808

* Fixed that MissingSourceFile's wasn't properly detected in production mode #925 [Nicholas Seckar]

* Fixed that :counter_cache option would look for a line_items_count column for a LineItem object instead of lineitems_count

* Fixed that AR exists?() would explode on postgresql if the passed id did not match the PK type #900 [Scott Barron]

* Fixed the MS SQL adapter to work with the new limit/offset approach and with binary data (still suffering from 7KB limit, though) #901 [delynnb]


*1.9.0* (22th March, 2005)

* Added adapter independent limit clause as a two-element array with the first being the limit, the second being the offset #795 [Sam Stephenson]. Example:

    Developer.find_all nil, 'id ASC', 5      # return the first five developers 
    Developer.find_all nil, 'id ASC', [3, 8] # return three developers, starting from #8 and forward

  This doesn't yet work with the DB2 or MS SQL adapters. Patches to make that happen are encouraged. 

* Added alias_method :to_param, :id to Base, such that Active Record objects to be used as URL parameters in Action Pack automatically #812 [Nicholas Seckar/Sam Stephenson]

* Improved the performance of the OCI8 adapter for Oracle #723 [pilx/gjenkins]

* Added type conversion before saving a record, so string-based values like "10.0" aren't left for the database to convert #820 [dave@cherryville.org]

* Added with additional settings for working with transactional fixtures and pre-loaded test databases #865 [mindel]

* Fixed acts_as_list to trigger remove_from_list on destroy after the fact, not before, so a unique position can be maintained #871 [Alisdair McDiarmid]

* Added the possibility of specifying fixtures in multiple calls #816 [kim@tinker.com]

* Added Base.exists?(id) that'll return true if an object of the class with the given id exists #854 [stian@grytoyr.net]

* Added optionally allow for nil or empty strings with validates_numericality_of #801 [Sebastian Kanthak]

* Fixed problem with using slashes in validates_format_of regular expressions #801 [Sebastian Kanthak]

* Fixed that SQLite3 exceptions are caught and reported properly #823 [yerejm]

* Added that all types of after_find/after_initialized callbacks are triggered if the explicit implementation is present, not only the explicit implementation itself

* Fixed that symbols can be used on attribute assignment, like page.emails.create(:subject => data.subject, :body => data.body)


*1.8.0* (7th March, 2005)

* Added ActiveRecord::Base.colorize_logging to control whether to use colors in logs or not (on by default)

* Added support for timestamp with time zone in PostgreSQL #560 [Scott Barron]

* Added MultiparameterAssignmentErrors and AttributeAssignmentError exceptions #777 [demetrius]. Documentation:

   * +MultiparameterAssignmentErrors+ -- collection of errors that occurred during a mass assignment using the 
     +attributes=+ method. The +errors+ property of this exception contains an array of +AttributeAssignmentError+ 
     objects that should be inspected to determine which attributes triggered the errors.
   * +AttributeAssignmentError+ -- an error occurred while doing a mass assignment through the +attributes=+ method.
     You can inspect the +attribute+ property of the exception object to determine which attribute triggered the error.

* Fixed that postgresql adapter would fails when reading bytea fields with null value #771 [rodrigo k]

* Added transactional fixtures that uses rollback to undo changes to fixtures instead of DELETE/INSERT -- it's much faster. See documentation under Fixtures #760 [Jeremy Kemper]

* Added destruction of dependent objects in has_one associations when a new assignment happens #742 [mindel]. Example:

    class Account < ActiveRecord::Base
      has_one :credit_card, :dependent => true
    end
    class CreditCard < ActiveRecord::Base
      belongs_to :account
    end

    account.credit_card # => returns existing credit card, lets say id = 12
    account.credit_card = CreditCard.create("number" => "123")
    account.save # => CC with id = 12 is destroyed


3110
* Added validates_numericality_of #716 [Sebastian Kanthak/Chris McGrath]. Docuemntation:
3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179

    Validates whether the value of the specified attribute is numeric by trying to convert it to
    a float with Kernel.Float (if <tt>integer</tt> is false) or applying it to the regular expression
    <tt>/^[\+\-]?\d+$/</tt> (if <tt>integer</tt> is set to true).

      class Person < ActiveRecord::Base
        validates_numericality_of :value, :on => :create
      end

    Configuration options:
    * <tt>message</tt> - A custom error message (default is: "is not a number")
    * <tt>on</tt> Specifies when this validation is active (default is :save, other options :create, :update)
    * <tt>only_integer</tt> Specifies whether the value has to be an integer, e.g. an integral value (default is false)


* Fixed that HasManyAssociation#count was using :finder_sql rather than :counter_sql if it was available #445 [Scott Barron]

* Added better defaults for composed_of, so statements like composed_of :time_zone, :mapping => %w( time_zone time_zone ) can be written without the mapping part (it's now assumed)

* Added MacroReflection#macro which will return a symbol describing the macro used (like :composed_of or :has_many) #718, #248 [james@slashetc.com]


*1.7.0* (24th February, 2005)

* Changed the auto-timestamping feature to use ActiveRecord::Base.default_timezone instead of entertaining the parallel ActiveRecord::Base.timestamps_gmt method. The latter is now deprecated and will throw a warning on use (but still work) #710 [Jamis Buck]

* Added a OCI8-based Oracle adapter that has been verified to work with Oracle 8 and 9 #629 [Graham Jenkins]. Usage notes:

    1.  Key generation uses a sequence "rails_sequence" for all tables. (I couldn't find a simple
        and safe way of passing table-specific sequence information to the adapter.)
    2.  Oracle uses DATE or TIMESTAMP datatypes for both dates and times. Consequently I have had to
        resort to some hacks to get data converted to Date or Time in Ruby.
        If the column_name ends in _at (like created_at, updated_at) it's created as a Ruby Time. Else if the
        hours/minutes/seconds are 0, I make it a Ruby Date. Else it's a Ruby Time.
        This is nasty - but if you use Duck Typing you'll probably not care very much.
        In 9i it's tempting to map DATE to Date and TIMESTAMP to Time but I don't think that is
        valid - too many databases use DATE for both.
        Timezones and sub-second precision on timestamps are not supported.
    3.  Default values that are functions (such as "SYSDATE") are not supported. This is a
        restriction of the way active record supports default values.
    4.  Referential integrity constraints are not fully supported. Under at least
        some circumstances, active record appears to delete parent and child records out of
        sequence and out of transaction scope. (Or this may just be a problem of test setup.)

  The OCI8 driver can be retrieved from http://rubyforge.org/projects/ruby-oci8/

* Added option :schema_order to the PostgreSQL adapter to support the use of multiple schemas per database #697 [YuriSchimke]

* Optimized the SQL used to generate has_and_belongs_to_many queries by listing the join table first #693 [yerejm]

* Fixed that when using validation macros with a custom message, if you happened to use single quotes in the message string you would get a parsing error #657 [tonka]

* Fixed that Active Record would throw Broken Pipe errors with FCGI when the MySQL connection timed out instead of reconnecting #428 [Nicholas Seckar]

* Added options to specify an SSL connection for MySQL. Define the following attributes in the connection config (config/database.yml in Rails) to use it: sslkey, sslcert, sslca, sslcapath, sslcipher. To use SSL with no client certs, just set :sslca = '/dev/null'. http://dev.mysql.com/doc/mysql/en/secure-connections.html #604 [daniel@nightrunner.com]

* Added automatic dropping/creating of test tables for running the unit tests on all databases #587 [adelle@bullet.net.au]

* Fixed that find_by_* would fail when column names had numbers #670 [demetrius]

* Fixed the SQL Server adapter on a bunch of issues #667 [DeLynn]

    1. Created a new columns method that is much cleaner. 
    2. Corrected a problem with the select and select_all methods 
       that didn't account for the LIMIT clause being passed into raw SQL statements. 
    3. Implemented the string_to_time method in order to create proper instances of the time class. 
    4. Added logic to the simplified_type method that allows the database to specify the scale of float data. 
    5. Adjusted the quote_column_name to account for the fact that MS SQL is bothered by a forward slash in the data string.

3180
* Fixed that the dynamic finder like find_all_by_something_boolean(false) didn't work #649 [lmarlow]
3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350

* Added validates_each that validates each specified attribute against a block #610 [Jeremy Kemper]. Example:

    class Person < ActiveRecord::Base
      validates_each :first_name, :last_name do |record, attr|
        record.errors.add attr, 'starts with z.' if attr[0] == ?z
      end
    end

* Added :allow_nil as an explicit option for validates_length_of, so unless that's set to true having the attribute as nil will also return an error if a range is specified as :within #610 [Jeremy Kemper]

* Added that validates_* now accept blocks to perform validations #618 [Tim Bates]. Example:

    class Person < ActiveRecord::Base
      validate { |person| person.errors.add("title", "will never be valid") if SHOULD_NEVER_BE_VALID }
    end

* Addded validation for validate all the associated objects before declaring failure with validates_associated #618 [Tim Bates]

* Added keyword-style approach to defining the custom relational bindings #545 [Jamis Buck]. Example:

    class Project < ActiveRecord::Base
      primary_key "sysid"
      table_name "XYZ_PROJECT"
      inheritance_column { original_inheritance_column + "_id" }
    end

* Fixed Base#clone for use with PostgreSQL #565 [hanson@surgery.wisc.edu]


*1.6.0* (January 25th, 2005)

* Added that has_many association build and create methods can take arrays of record data like Base#create and Base#build to build/create multiple records at once.

* Added that Base#delete and Base#destroy both can take an array of ids to delete/destroy #336

* Added the option of supplying an array of attributes to Base#create, so that multiple records can be created at once.

* Added the option of supplying an array of ids and attributes to Base#update, so that multiple records can be updated at once (inspired by #526/Duane Johnson). Example

    people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy"} }
    Person.update(people.keys, people.values)

* Added ActiveRecord::Base.timestamps_gmt that can be set to true to make the automated timestamping use GMT instead of local time #520 [Scott Baron]

* Added that update_all calls sanitize_sql on its updates argument, so stuff like MyRecord.update_all(['time = ?', Time.now]) works #519 [notahat]

* Fixed that the dynamic finders didn't treat nil as a "IS NULL" but rather "= NULL" case #515 [Demetrius]

* Added bind-named arrays for interpolating a group of ids or strings in conditions #528 [Jeremy Kemper]

* Added that has_and_belongs_to_many associations with additional attributes also can be created between unsaved objects and only committed to the database when Base#save is called on the associator #524 [Eric Anderson]

* Fixed that records fetched with piggy-back attributes or through rich has_and_belongs_to_many associations couldn't be saved due to the extra attributes not part of the table #522 [Eric Anderson]

* Added mass-assignment protection for the inheritance column -- regardless of a custom column is used or not

* Fixed that association proxies would fail === tests like PremiumSubscription === @account.subscription

* Fixed that column aliases didn't work as expected with the new MySql411 driver #507 [Demetrius]

* Fixed that find_all would produce invalid sql when called sequentialy #490 [Scott Baron]


*1.5.1* (January 18th, 2005)

* Fixed that the belongs_to and has_one proxy would fail a test like 'if project.manager' -- this unfortunately also means that you can't call methods like project.manager.build unless there already is a manager on the project #492 [Tim Bates]

* Fixed that the Ruby/MySQL adapter wouldn't connect if the password was empty #503 [Pelle]


*1.5.0* (January 17th, 2005)

* Fixed that unit tests for MySQL are now run as the "rails" user instead of root #455 [Eric Hodel]

* Added validates_associated that enables validation of objects in an unsaved association #398 [Tim Bates]. Example:

    class Book < ActiveRecord::Base
      has_many :pages
      belongs_to :library

      validates_associated :pages, :library
    end

* Added support for associating unsaved objects #402 [Tim Bates]. Rules that govern this addition:

    == Unsaved objects and associations

    You can manipulate objects and associations before they are saved to the database, but there is some special behaviour you should be
    aware of, mostly involving the saving of associated objects.

    === One-to-one associations

    * Assigning an object to a has_one association automatically saves that object, and the object being replaced (if there is one), in
      order to update their primary keys - except if the parent object is unsaved (new_record? == true).
    * If either of these saves fail (due to one of the objects being invalid) the assignment statement returns false and the assignment
      is cancelled.
    * If you wish to assign an object to a has_one association without saving it, use the #association.build method (documented below).
    * Assigning an object to a belongs_to association does not save the object, since the foreign key field belongs on the parent. It does
      not save the parent either.

    === Collections

    * Adding an object to a collection (has_many or has_and_belongs_to_many) automatically saves that object, except if the parent object
      (the owner of the collection) is not yet stored in the database.
    * If saving any of the objects being added to a collection (via #push or similar) fails, then #push returns false.
    * You can add an object to a collection without automatically saving it by using the #collection.build method (documented below).
    * All unsaved (new_record? == true) members of the collection are automatically saved when the parent is saved.

* Added replace to associations, so you can do project.manager.replace(new_manager) or project.milestones.replace(new_milestones) #402 [Tim Bates]

* Added build and create methods to has_one and belongs_to associations, so you can now do project.manager.build(attributes) #402 [Tim Bates]

* Added that if a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last. #402 [Tim Bates]

* Fixed that Base#== wouldn't work for multiple references to the same unsaved object #402 [Tim Bates]

* Fixed binary support for PostgreSQL #444 [alex@byzantine.no]

* Added a differenciation between AssociationCollection#size and -length. Now AssociationCollection#size returns the size of the 
  collection by executing a SELECT COUNT(*) query if the collection hasn't been loaded and calling collection.size if it has. If 
  it's more likely than not that the collection does have a size larger than zero and you need to fetch that collection afterwards, 
  it'll take one less SELECT query if you use length.

* Added Base#attributes that returns a hash of all the attributes with their names as keys and clones of their objects as values #433 [atyp.de]

* Fixed that foreign keys named the same as the association would cause stack overflow #437 [Eric Anderson]

* Fixed default scope of acts_as_list from "1" to "1 = 1", so it'll work in PostgreSQL (among other places) #427 [Alexey]

* Added Base#reload that reloads the attributes of an object from the database #422 [Andreas Schwarz]

* Added SQLite3 compatibility through the sqlite3-ruby adapter by Jamis Buck #381 [Jeremy Kemper]

* Added support for the new protocol spoken by MySQL 4.1.1+ servers for the Ruby/MySQL adapter that ships with Rails #440 [Matt Mower] 

* Added that Observers can use the observes class method instead of overwriting self.observed_class().

    Before:
      class ListSweeper < ActiveRecord::Base
        def self.observed_class() [ List, Item ]
      end

    After:
      class ListSweeper < ActiveRecord::Base
        observes List, Item
      end

* Fixed that conditions in has_many and has_and_belongs_to_many should be interpolated just like the finder_sql is

* Fixed Base#update_attribute to be indifferent to whether a string or symbol is used to describe the name

* Added Base#toggle(attribute) and Base#toggle!(attribute) that makes it easier to flip a switch or flag.

    Before: topic.update_attribute(:approved, !approved?)
    After : topic.toggle!(:approved)

* Added Base#increment!(attribute) and Base#decrement!(attribute) that also saves the records. Example:

    page.views # => 1
    page.increment!(:views) # executes an UPDATE statement
    page.views # => 2

    page.increment(:views).increment!(:views)
    page.views # => 4

* Added Base#increment(attribute) and Base#decrement(attribute) that encapsulates the += 1 and -= 1 patterns.



3351

3352 3353 3354 3355 3356
*1.14.2* (April 9th, 2005)

* Fixed calculations for the Oracle Adapter (closes #4626) [Michael Schoen]


D
David Heinemeier Hansson 已提交
3357
*1.14.1* (April 6th, 2006)
3358

3359 3360
* Fix type_name_with_module to handle type names that begin with '::'. Closes #4614. [Nicholas Seckar]

3361
* Fixed that that multiparameter assignment doesn't work with aggregations (closes #4620) [Lars Pind]
3362

3363
* Enable Limit/Offset in Calculations (closes #4558) [lmarlow]
3364

3365
* Fixed that loading including associations returns all results if Load IDs For Limited Eager Loading returns none (closes #4528) [Rick Olson]
3366

3367 3368
* Fixed HasManyAssociation#find bugs when :finder_sql is set #4600 [lagroue@free.fr]

3369
* Allow AR::Base#respond_to? to behave when @attributes is nil [Ryan Davis]
3370

3371
* Support eager includes when going through a polymorphic has_many association. [Rick Olson]
3372

3373
* Added support for eagerly including polymorphic has_one associations. (closes #4525) [Rick Olson]
3374 3375 3376 3377 3378 3379 3380

    class Post < ActiveRecord::Base
      has_one :tagging, :as => :taggable
    end
    
    Post.find :all, :include => :tagging

3381
* Added descriptive error messages for invalid has_many :through associations: going through :has_one or :has_and_belongs_to_many [Rick Olson]
3382

3383
* Added support for going through a polymorphic has_many association: (closes #4401) [Rick Olson]
3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394

    class PhotoCollection < ActiveRecord::Base
      has_many :photos, :as => :photographic
      belongs_to :firm
    end
     
    class Firm < ActiveRecord::Base
      has_many :photo_collections
      has_many :photos, :through => :photo_collections
    end

3395 3396
* Multiple fixes and optimizations in PostgreSQL adapter, allowing ruby-postgres gem to work properly. [ruben.nine@gmail.com]

3397 3398
* Fixed that AssociationCollection#delete_all should work even if the records of the association are not loaded yet. [Florian Weber]

3399 3400
* Changed those private ActiveRecord methods to take optional third argument :auto instead of nil for performance optimizations.  (closes #4456) [Stefan]

3401
* Private ActiveRecord methods add_limit!, add_joins!, and add_conditions! take an OPTIONAL third argument 'scope' (closes #4456) [Rick Olson]
3402

3403
* DEPRECATED: Using additional attributes on has_and_belongs_to_many associations. Instead upgrade your association to be a real join model [David Heinemeier Hansson]
3404

3405
* Fixed that records returned from has_and_belongs_to_many associations with additional attributes should be marked as read only (fixes #4512) [David Heinemeier Hansson]
3406

3407 3408
* Do not implicitly mark recordss of has_many :through as readonly but do mark habtm records as readonly (eventually only on join tables without rich attributes). [Marcel Mollina Jr.]

3409
* Fixed broken OCIAdapter #4457 [Michael Schoen]
3410 3411


D
David Heinemeier Hansson 已提交
3412
*1.14.0* (March 27th, 2006)
3413

3414 3415
* Replace 'rescue Object' with a finer grained rescue. Closes #4431. [Nicholas Seckar]

3416
* Fixed eager loading so that an aliased table cannot clash with a has_and_belongs_to_many join table [Rick Olson]
3417

3418 3419
* Add support for :include to with_scope [andrew@redlinesoftware.com]

3420
* Support the use of public synonyms with the Oracle adapter; required ruby-oci8 v0.1.14 #4390 [Michael Schoen]
3421

3422 3423
* Change periods (.) in table aliases to _'s.  Closes #4251 [jeff@ministrycentered.com]

3424
* Changed has_and_belongs_to_many join to INNER JOIN for Mysql 3.23.x.  Closes #4348 [Rick Olson]
3425

3426
* Fixed issue that kept :select options from being scoped [Rick Olson]
3427

3428
* Fixed db_schema_import when binary types are present #3101 [David Heinemeier Hansson]
3429

3430
* Fixed that MySQL enums should always be returned as strings #3501 [David Heinemeier Hansson]
3431

3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444
* Change has_many :through to use the :source option to specify the source association.  :class_name is now ignored. [Rick Olson]

    class Connection < ActiveRecord::Base
      belongs_to :user
      belongs_to :channel
    end

    class Channel < ActiveRecord::Base
      has_many :connections
      has_many :contacts, :through => :connections, :class_name => 'User' # OLD
      has_many :contacts, :through => :connections, :source => :user      # NEW
    end

3445 3446
* Fixed DB2 adapter so nullable columns will be determines correctly now and quotes from column default values will be removed #4350 [contact@maik-schmidt.de]

3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460
* Allow overriding of find parameters in scoped has_many :through calls [Rick Olson]

  In this example, :include => false disables the default eager association from loading.  :select changes the standard
  select clause.  :joins specifies a join that is added to the end of the has_many :through query.
  
    class Post < ActiveRecord::Base
      has_many :tags, :through => :taggings, :include => :tagging do
        def add_joins_and_select
          find :all, :select => 'tags.*, authors.id as author_id', :include => false,
            :joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id'
        end
      end
    end
    
3461
* Fixed that schema changes while the database was open would break any connections to a SQLite database (now we reconnect if that error is throw) [David Heinemeier Hansson]
3462

3463
* Don't classify the has_one class when eager loading, it is already singular. Add tests. (closes #4117) [Jonathan Viney]
3464

3465 3466
* Quit ignoring default :include options in has_many :through calls [Mark James]

3467
* Allow has_many :through associations to find the source association by setting a custom class (closes #4307) [Jonathan Viney]
3468

R
Rick Olson 已提交
3469 3470
* Eager Loading support added for has_many :through => :has_many associations (see below).  [Rick Olson]

3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486
* Allow has_many :through to work on has_many associations (closes #3864) [sco@scottraymond.net]  Example:

    class Firm < ActiveRecord::Base
      has_many :clients
      has_many :invoices, :through => :clients
    end
  
    class Client < ActiveRecord::Base
      belongs_to :firm
      has_many   :invoices
    end
  
    class Invoice < ActiveRecord::Base
      belongs_to :client
    end

3487
* Raise error when trying to select many polymorphic objects with has_many :through or :include (closes #4226) [Josh Susser]
3488

3489
* Fixed has_many :through to include :conditions set on the :through association. closes #4020 [Jonathan Viney]
3490

3491
* Fix that has_many :through honors the foreign key set by the belongs_to association in the join model (closes #4259) [andylien@gmail.com / Rick Olson]
3492

3493
* SQL Server adapter gets some love #4298 [Ryan Tomayko]
3494

3495 3496
* Added OpenBase database adapter that builds on top of the http://www.spice-of-life.net/ruby-openbase/ driver. All functionality except LIMIT/OFFSET is supported #3528 [derrickspell@cdmplus.com]

3497 3498 3499 3500
* Rework table aliasing to account for truncated table aliases.  Add smarter table aliasing when doing eager loading of STI associations. This allows you to use the association name in the order/where clause. [Jonathan Viney / Rick Olson] #4108 Example (SpecialComment is using STI):

    Author.find(:all, :include => { :posts => :special_comments }, :order => 'special_comments.body')

3501
* Add AbstractAdapter#table_alias_for to create table aliases according to the rules of the current adapter. [Rick Olson]
3502

3503
* Provide access to the underlying database connection through Adapter#raw_connection. Enables the use of db-specific methods without complicating the adapters. #2090 [Michael Koziarski]
3504

3505
* Remove broken attempts at handling columns with a default of 'now()' in the postgresql adapter. #2257 [Michael Koziarski]
3506

3507
* Added connection#current_database that'll return of the current database (only works in MySQL, SQL Server, and Oracle so far -- please help implement for the rest of the adapters) #3663 [Tom Ward]
3508

R
Rick Olson 已提交
3509
* Fixed that Migration#execute would have the table name prefix appended to its query #4110 [mark.imbriaco@pobox.com]
3510

3511 3512
* Make all tinyint(1) variants act like boolean in mysql (tinyint(1) unsigned, etc.) [Jamis Buck]

3513
* Use association's :conditions when eager loading. [Jeremy Evans] #4144
3514

3515
* Alias the has_and_belongs_to_many join table on eager includes. #4106 [Jeremy Evans]
3516 3517 3518 3519 3520

  This statement would normally error because the projects_developers table is joined twice, and therefore joined_on would be ambiguous.

    Developer.find(:all, :include => {:projects => :developers}, :conditions => 'join_project_developers.joined_on IS NOT NULL')

3521
* Oracle adapter gets some love #4230 [Michael Schoen]
3522 3523 3524 3525 3526 3527 3528

    * Changes :text to CLOB rather than BLOB [Moses Hohman]
    * Fixes an issue with nil numeric length/scales (several)
    * Implements support for XMLTYPE columns [wilig / Kubo Takehiro]
    * Tweaks a unit test to get it all green again
    * Adds support for #current_database

3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549
* Added Base.abstract_class? that marks which classes are not part of the Active Record hierarchy #3704 [Rick Olson]

    class CachedModel < ActiveRecord::Base
      self.abstract_class = true
    end
    
    class Post < CachedModel
    end
    
    CachedModel.abstract_class?
    => true
    
    Post.abstract_class?
    => false

    Post.base_class
    => Post
    
    Post.table_name
    => 'posts'

3550 3551 3552 3553 3554 3555
* Allow :dependent options to be used with polymorphic joins. #3820 [Rick Olson]

    class Foo < ActiveRecord::Base
      has_many :attachments, :as => :attachable, :dependent => :delete_all
    end

3556
* Nicer error message on has_many :through when :through reflection can not be found. #4042 [court3nay]
3557

J
Jamis Buck 已提交
3558 3559
* Upgrade to Transaction::Simple 1.3 [Jamis Buck]

3560 3561
* Catch FixtureClassNotFound when using instantiated fixtures on a fixture that has no ActiveRecord model [Rick Olson]

3562 3563
* Allow ordering of calculated results and/or grouped fields in calculations [solo@gatelys.com]

3564 3565
* Make ActiveRecord::Base#save! return true instead of nil on success.  #4173 [johan@johansorensen.com]

3566 3567
* Dynamically set allow_concurrency.  #4044 [Stefan Kaes]

3568
* Added Base#to_xml that'll turn the current record into a XML representation [David Heinemeier Hansson]. Example:
3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590

    topic.to_xml
  
  ...returns:
  
    <?xml version="1.0" encoding="UTF-8"?>
    <topic>
      <title>The First Topic</title>
      <author-name>David</author-name>
      <id type="integer">1</id>
      <approved type="boolean">false</approved>
      <replies-count type="integer">0</replies-count>
      <bonus-time type="datetime">2000-01-01 08:28:00</bonus-time>
      <written-on type="datetime">2003-07-16 09:28:00</written-on>
      <content>Have a nice day</content>
      <author-email-address>david@loudthinking.com</author-email-address>
      <parent-id></parent-id>
      <last-read type="date">2004-04-15</last-read>
    </topic>
  
  ...and you can configure with:
  
3591
    topic.to_xml(:skip_instruct => true, :except => [ :id, bonus_time, :written_on, replies_count ])
3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603
  
  ...that'll return:
  
    <topic>
      <title>The First Topic</title>
      <author-name>David</author-name>
      <approved type="boolean">false</approved>
      <content>Have a nice day</content>
      <author-email-address>david@loudthinking.com</author-email-address>
      <parent-id></parent-id>
      <last-read type="date">2004-04-15</last-read>
    </topic>
3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630
  
  You can even do load first-level associations as part of the document:
  
    firm.to_xml :include => [ :account, :clients ]
  
  ...that'll return something like:
  
    <?xml version="1.0" encoding="UTF-8"?>
    <firm>
      <id type="integer">1</id>
      <rating type="integer">1</rating>
      <name>37signals</name>
      <clients>
        <client>
          <rating type="integer">1</rating>
          <name>Summit</name>
        </client>
        <client>
          <rating type="integer">1</rating>
          <name>Microsoft</name>
        </client>
      </clients>
      <account>
        <id type="integer">1</id>
        <credit-limit type="integer">50</credit-limit>
      </account>
    </firm>  
3631

3632 3633
* Allow :counter_cache to take a column name for custom counter cache columns [Jamis Buck]

3634 3635
* Documentation fixes for :dependent [robby@planetargon.com]

3636 3637
* Stop the MySQL adapter crashing when views are present. #3782 [Jonathan Viney]

3638 3639
* Don't classify the belongs_to class, it is already singular #4117 [keithm@infused.org]

3640 3641
* Allow set_fixture_class to take Classes instead of strings for a class in a module.  Raise FixtureClassNotFound if a fixture can't load.  [Rick Olson]

3642 3643
* Fix quoting of inheritance column for STI eager loading #4098 [Jonathan Viney <jonathan@bluewire.net.nz>]

3644 3645 3646
* Added smarter table aliasing for eager associations for multiple self joins #3580 [Rick Olson]

    * The first time a table is referenced in a join, no alias is used.
3647
    * After that, the parent class name and the reflection name are used.
3648
    
3649
        Tree.find(:all, :include => :children) # LEFT OUTER JOIN trees AS tree_children ...
3650 3651 3652 3653 3654
    
    * Any additional join references get a numerical suffix like '_2', '_3', etc.

* Fixed eager loading problems with single-table inheritance #3580 [Rick Olson]. Post.find(:all, :include => :special_comments) now returns all posts, and any special comments that the posts may have. And made STI work with has_many :through and polymorphic belongs_to.

3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683
* Added cascading eager loading that allows for queries like Author.find(:all, :include=> { :posts=> :comments }), which will fetch all authors, their posts, and the comments belonging to those posts in a single query (using LEFT OUTER JOIN) #3913 [anna@wota.jp]. Examples:

    # cascaded in two levels
    >> Author.find(:all, :include=>{:posts=>:comments})
    => authors
         +- posts
              +- comments
    
    # cascaded in two levels and normal association
    >> Author.find(:all, :include=>[{:posts=>:comments}, :categorizations])
    => authors
         +- posts
              +- comments
         +- categorizations
    
    # cascaded in two levels with two has_many associations
    >> Author.find(:all, :include=>{:posts=>[:comments, :categorizations]})
    => authors
         +- posts
              +- comments
              +- categorizations
    
    # cascaded in three levels
    >> Company.find(:all, :include=>{:groups=>{:members=>{:favorites}}})
    => companies
         +- groups
              +- members
                   +- favorites
    
3684 3685
* Make counter cache work when replacing an association #3245 [eugenol@gmail.com]

J
Jamis Buck 已提交
3686 3687
* Make migrations verbose [Jamis Buck]

3688 3689
* Make counter_cache work with polymorphic belongs_to [Jamis Buck]

3690 3691
* Fixed that calling HasOneProxy#build_model repeatedly would cause saving to happen #4058 [anna@wota.jp]

3692
* Added Sybase database adapter that relies on the Sybase Open Client bindings (see http://raa.ruby-lang.org/project/sybase-ctlib) #3765 [John Sheets]. It's almost completely Active Record compliant (including migrations), but has the following caveats:
3693 3694 3695 3696 3697 3698

    * Does not support DATE SQL column types; use DATETIME instead.
    * Date columns on HABTM join tables are returned as String, not Time.
    * Insertions are potentially broken for :polymorphic join tables
    * BLOB column access not yet fully supported

3699 3700
* Clear stale, cached connections left behind by defunct threads. [Jeremy Kemper]

3701 3702
* CHANGED DEFAULT: set ActiveRecord::Base.allow_concurrency to false.  Most AR usage is in single-threaded applications. [Jeremy Kemper]

3703
* Renamed the "oci" adapter to "oracle", but kept the old name as an alias #4017 [Michael Schoen]
3704

3705
* Fixed that Base.save should always return false if the save didn't succeed, including if it has halted by before_save's #1861, #2477 [David Heinemeier Hansson]
D
David Heinemeier Hansson 已提交
3706

3707 3708
* Speed up class -> connection caching and stale connection verification.  #3979 [Stefan Kaes]

N
Nicholas Seckar 已提交
3709
* Add set_fixture_class to allow the use of table name accessors with models which use set_table_name. [Kevin Clark]
3710

3711 3712
* Added that fixtures to placed in subdirectories of the main fixture files are also loaded #3937 [dblack@wobblini.net]

3713
* Define attribute query methods to avoid method_missing calls. #3677 [Jonathan Viney]
3714

3715 3716
* ActiveRecord::Base.remove_connection explicitly closes database connections and doesn't corrupt the connection cache. Introducing the disconnect! instance method for the PostgreSQL, MySQL, and SQL Server adapters; implementations for the others are welcome.  #3591 [Simon Stapleton, Tom Ward]

3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732
* Added support for nested scopes #3407 [anna@wota.jp]. Examples:

    Developer.with_scope(:find => { :conditions => "salary > 10000", :limit => 10 }) do
      Developer.find(:all)     # => SELECT * FROM developers WHERE (salary > 10000) LIMIT 10

      # inner rule is used. (all previous parameters are ignored)
      Developer.with_exclusive_scope(:find => { :conditions => "name = 'Jamis'" }) do
        Developer.find(:all)   # => SELECT * FROM developers WHERE (name = 'Jamis')
      end

      # parameters are merged
      Developer.with_scope(:find => { :conditions => "name = 'Jamis'" }) do
        Developer.find(:all)   # => SELECT * FROM developers WHERE (( salary > 10000 ) AND ( name = 'Jamis' )) LIMIT 10
      end
    end

3733 3734
* Fixed db2 connection with empty user_name and auth options #3622 [phurley@gmail.com]

3735 3736
* Fixed validates_length_of to work on UTF-8 strings by using characters instead of bytes #3699 [Masao Mutoh]

3737
* Fixed that reflections would bleed across class boundaries in single-table inheritance setups #3796 [Lars Pind]
3738

3739 3740 3741 3742 3743 3744 3745
* Added calculations: Base.count, Base.average, Base.sum, Base.minimum, Base.maxmium, and the generic Base.calculate. All can be used with :group and :having. Calculations and statitics need no longer require custom SQL. #3958 [Rick Olson]. Examples:

    Person.average :age
    Person.minimum :age
    Person.maximum :age
    Person.sum :salary, :group => :last_name

3746
* Renamed Errors#count to Errors#size but kept an alias for the old name (and included an alias for length too) #3920 [Luke Redpath]
3747

3748 3749
* Reflections don't attempt to resolve module nesting of association classes. Simplify type computation. [Jeremy Kemper]

3750 3751 3752 3753
* Improved the Oracle OCI Adapter with better performance for column reflection (from #3210), fixes to migrations (from #3476 and #3742), tweaks to unit tests (from #3610), and improved documentation (from #2446) #3879 [Aggregated by schoenm@earthlink.net]

* Fixed that the schema_info table used by ActiveRecord::Schema.define should respect table pre- and suffixes #3834 [rubyonrails@atyp.de]

3754
* Added :select option to Base.count that'll allow you to select something else than * to be counted on. Especially important for count queries using DISTINCT #3839 [Stefan Kaes]
3755

3756 3757
* Correct syntax error in mysql DDL,  and make AAACreateTablesTest run first [Bob Silva]

3758 3759
* Allow :include to be used with has_many :through associations #3611 [Michael Schoen]

3760 3761
* PostgreSQL: smarter schema dumps using pk_and_sequence_for(table).  #2920 [Blair Zajac]

3762 3763
* SQLServer: more compatible limit/offset emulation.  #3779 [Tom Ward]

3764 3765
* Polymorphic join support for has_one associations (has_one :foo, :as => :bar)  #3785 [Rick Olson]

3766 3767
* PostgreSQL: correctly parse negative integer column defaults.  #3776 [bellis@deepthought.org]

3768 3769
* Fix problems with count when used with :include [Jeremy Hopple and Kevin Clark]

3770
* ActiveRecord::RecordInvalid now states which validations failed in its default error message [Tobias Lütke]
3771

3772
* Using AssociationCollection#build with arrays of hashes should call build, not create [David Heinemeier Hansson]
3773

3774 3775
* Remove definition of reloadable? from ActiveRecord::Base to make way for new Reloadable code. [Nicholas Seckar]

3776 3777
* Fixed schema handling for DB2 adapter that didn't work: an initial schema could be set, but it wasn't used when getting tables and indexes #3678 [Maik Schmidt]

3778
* Support the :column option for remove_index with the PostgreSQL adapter. #3661 [Shugo Maeda]
3779

3780 3781
* Add documentation for add_index and remove_index. #3600 [Manfred Stienstra <m.stienstra@fngtps.com>]

3782
* If the OCI library is not available, raise an exception indicating as much. #3593 [Michael Schoen]
3783

3784 3785
* Add explicit :order in finder tests as postgresql orders results differently by default. #3577. [Rick Olson]

3786 3787
* Make dynamic finders honor additional passed in :conditions. #3569 [Oleg Pudeyev <pudeyo@rpi.edu>, Marcel Molina Jr.]

3788 3789
* Show a meaningful error when the DB2 adapter cannot be loaded due to missing dependencies. [Nicholas Seckar]

3790
* Make .count work for has_many associations with multi line finder sql [Michael Schoen]
3791

3792 3793
* Add AR::Base.base_class for querying the ancestor AR::Base subclass [Jamis Buck]

3794 3795
* Allow configuration of the column used for optimistic locking [wilsonb@gmail.com]

3796 3797
* Don't hardcode 'id' in acts as list.  [ror@philippeapril.com]

3798
* Fix date errors for SQLServer in association tests. #3406 [Kevin Clark]
3799

3800
* Escape database name in MySQL adapter when creating and dropping databases. #3409 [anna@wota.jp]
3801

3802
* Disambiguate table names for columns in validates_uniqueness_of's WHERE clause. #3423 [alex.borovsky@gmail.com]
3803

3804
* .with_scope imposed create parameters now bypass attr_protected [Tobias Lütke]
3805

3806 3807
* Don't raise an exception when there are more keys than there are named bind variables when sanitizing conditions. [Marcel Molina Jr.]

3808 3809
* Multiple enhancements and adjustments to DB2 adaptor. #3377 [contact@maik-schmidt.de]

M
Marcel Molina 已提交
3810 3811
* Sanitize scoped conditions. [Marcel Molina Jr.]

3812
* Added option to Base.reflection_of_all_associations to specify a specific association to scope the call. For example Base.reflection_of_all_associations(:has_many) [David Heinemeier Hansson]
3813

3814
* Added ActiveRecord::SchemaDumper.ignore_tables which tells SchemaDumper which tables to ignore. Useful for tables with funky column like the ones required for tsearch2. [Tobias Lütke]
3815

3816
* SchemaDumper now doesn't fail anymore when there are unknown column types in the schema. Instead the table is ignored and a Comment is left in the schema.rb. [Tobias Lütke]
3817

3818
* Fixed that saving a model with multiple habtm associations would only save the first one.  #3244 [yanowitz-rubyonrails@quantumfoam.org, Florian Weber]
3819

3820
* Fix change_column to work with PostgreSQL 7.x and 8.x.  #3141 [wejn@box.cz, Rick Olson, Scott Barron] 
3821

3822
* removed :piggyback in favor of just allowing :select on :through associations. [Tobias Lütke] 
3823

3824
* made method missing delegation to class methods on relation target work on :through associations. [Tobias Lütke] 
3825

3826
* made .find() work on :through relations. [Tobias Lütke] 
3827

3828 3829
* Fix typo in association docs. #3296. [Blair Zajac]

3830
* Fixed :through relations when using STI inherited classes would use the inherited class's name as foreign key on the join model [Tobias Lütke] 
3831

3832 3833 3834 3835
*1.13.2* (December 13th, 2005)

* Become part of Rails 1.0

3836 3837
* MySQL: allow encoding option for mysql.rb driver.  [Jeremy Kemper]

3838
* Added option inheritance for find calls on has_and_belongs_to_many and has_many assosociations [David Heinemeier Hansson]. Example:
3839 3840 3841 3842 3843 3844 3845 3846 3847

    class Post
      has_many :recent_comments, :class_name => "Comment", :limit => 10, :include => :author
    end
    
    post.recent_comments.find(:all) # Uses LIMIT 10 and includes authors
    post.recent_comments.find(:all, :limit => nil) # Uses no limit but include authors
    post.recent_comments.find(:all, :limit => nil, :include => nil) # Uses no limit and doesn't include authors

3848
* Added option to specify :group, :limit, :offset, and :select options from find on has_and_belongs_to_many and has_many assosociations [David Heinemeier Hansson]
3849

3850 3851
* MySQL: fixes for the bundled mysql.rb driver.  #3160 [Justin Forder]

3852 3853 3854 3855 3856 3857 3858 3859 3860 3861
* SQLServer: fix obscure optimistic locking bug.  #3068 [kajism@yahoo.com]

* SQLServer: support uniqueidentifier columns.  #2930 [keithm@infused.org]

* SQLServer: cope with tables names qualified by owner.  #3067 [jeff@ministrycentered.com]

* SQLServer: cope with columns with "desc" in the name.  #1950 [Ron Lusk, Ryan Tomayko]

* SQLServer: cope with primary keys with "select" in the name.  #3057 [rdifrango@captechventures.com]

3862 3863
* Oracle: active? performs a select instead of a commit.  #3133 [Michael Schoen]

3864 3865
* MySQL: more robust test for nullified result hashes.  #3124 [Stefan Kaes]

3866
* Reloading an instance refreshes its aggregations as well as its associations.  #3024 [François Beausoleil]
3867

3868 3869
* Fixed that using :include together with :conditions array in Base.find would cause NoMethodError #2887 [Paul Hammmond]

3870 3871
* PostgreSQL: more robust sequence name discovery.  #3087 [Rick Olson]

3872 3873
* Oracle: use syntax compatible with Oracle 8.  #3131 [Michael Schoen]

3874 3875
* MySQL: work around ruby-mysql/mysql-ruby inconsistency with mysql.stat.  Eliminate usage of mysql.ping because it doesn't guarantee reconnect.  Explicitly close and reopen the connection instead.  [Jeremy Kemper]

3876
* Added preliminary support for polymorphic associations [David Heinemeier Hansson]
3877

3878
* Added preliminary support for join models [David Heinemeier Hansson]
3879

3880 3881
* Allow validate_uniqueness_of to be scoped by more than just one column.  #1559. [jeremy@jthopple.com, Marcel Molina Jr.]

3882 3883
* Firebird: active? and reconnect! methods for handling stale connections.  #428 [Ken Kunz <kennethkunz@gmail.com>]

3884 3885
* Firebird: updated for FireRuby 0.4.0.  #3009 [Ken Kunz <kennethkunz@gmail.com>]

3886
* MySQL and PostgreSQL: active? compatibility with the pure-Ruby driver.  #428 [Jeremy Kemper]
3887

3888 3889
* Oracle: active? check pings the database rather than testing the last command status.  #428 [Michael Schoen]

3890 3891
* SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find.  #2974 [kajism@yahoo.com]

3892 3893
* Reloading a model doesn't lose track of its connection.  #2996 [junk@miriamtech.com, Jeremy Kemper]

F
Florian Weber 已提交
3894
* Fixed bug where using update_attribute after pushing a record to a habtm association of the object caused duplicate rows in the join table. #2888 [colman@rominato.com, Florian Weber, Michael Schoen]
3895

3896 3897
* MySQL, PostgreSQL: reconnect! also reconfigures the connection.  Otherwise, the connection 'loses' its settings if it times out and is reconnected.  #2978 [Shugo Maeda]

3898 3899
* has_and_belongs_to_many: use JOIN instead of LEFT JOIN.  [Jeremy Kemper]

3900 3901
* MySQL: introduce :encoding option to specify the character set for client, connection, and results.  Only available for MySQL 4.1 and later with the mysql-ruby driver.  Do SHOW CHARACTER SET in mysql client to see available encodings.  #2975 [Shugo Maeda]

3902 3903
* Add tasks to create, drop and rebuild the MySQL and PostgreSQL test  databases. [Marcel Molina Jr.]

3904
* Correct boolean handling in generated reader methods.  #2945 [Don Park, Stefan Kaes]
3905

3906 3907
* Don't generate read methods for columns whose names are not valid ruby method names.  #2946 [Stefan Kaes]

3908 3909
* Document :force option to create_table.  #2921 [Blair Zajac <blair@orcaware.com>]

3910 3911
* Don't add the same conditions twice in has_one finder sql.  #2916 [Jeremy Evans]

3912 3913
* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]

3914 3915
* Introducing the Firebird adapter.  Quote columns and use attribute_condition more consistently.  Setup guide: http://wiki.rubyonrails.com/rails/pages/Firebird+Adapter  #1874 [Ken Kunz <kennethkunz@gmail.com>]

3916
* SQLServer: active? and reconnect! methods for handling stale connections.  #428 [kajism@yahoo.com, Tom Ward <tom@popdog.net>]
3917

3918 3919
* Associations handle case-equality more consistently: item.parts.is_a?(Array) and item.parts === Array.  #1345 [MarkusQ@reality.com]

3920 3921
* SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY.  #2866 [kajism@yahoo.com, Tom Ward <tom@popdog.net>]

3922 3923
* Oracle: active? and reconnect! methods for handling stale connections.  Optionally retry queries after reconnect.  #428 [Michael Schoen <schoenm@earthlink.net>]

3924 3925
* Correct documentation for Base.delete_all.  #1568 [Newhydra]

3926 3927
* Oracle: test case for column default parsing.  #2788 [Michael Schoen <schoenm@earthlink.net>]

3928 3929
* Update documentation for Migrations.  #2861 [Tom Werner <tom@cube6media.com>]

3930
* When AbstractAdapter#log rescues an exception, attempt to detect and reconnect to an inactive database connection.  Connection adapter must respond to the active? and reconnect! instance methods.  Initial support for PostgreSQL, MySQL, and SQLite.  Make certain that all statements which may need reconnection are performed within a logged block: for example, this means no avoiding log(sql, name) { } if @logger.nil?  #428 [Jeremy Kemper]
3931

3932
* Oracle: Much faster column reflection.  #2848 [Michael Schoen <schoenm@earthlink.net>]
3933

3934 3935 3936 3937 3938 3939
* Base.reset_sequence_name analogous to reset_table_name (mostly useful for testing).  Base.define_attr_method allows nil values.  [Jeremy Kemper]

* PostgreSQL: smarter sequence name defaults, stricter last_insert_id, warn on pk without sequence.  [Jeremy Kemper]

* PostgreSQL: correctly discover custom primary key sequences.  #2594 [Blair Zajac <blair@orcaware.com>, meadow.nnick@gmail.com, Jeremy Kemper]

3940 3941
* SQLServer: don't report limits for unsupported field types.  #2835 [Ryan Tomayko]

3942 3943
* Include the Enumerable module in ActiveRecord::Errors.  [Rick Bradley <rick@rickbradley.com>]

3944 3945
* Add :group option, correspond to GROUP BY, to the find method and to the has_many association.  #2818 [rubyonrails@atyp.de]

3946 3947
* Don't cast nil or empty strings to a dummy date.  #2789 [Rick Bradley <rick@rickbradley.com>]

3948 3949
* acts_as_list plays nicely with inheritance by remembering the class which declared it.  #2811 [rephorm@rephorm.com]

3950 3951
* Fix sqlite adaptor's detection of missing dbfile or database declaration. [Nicholas Seckar]

3952
* Fixed acts_as_list for definitions without an explicit :order #2803 [Jonathan Viney]
3953 3954

* Upgrade bundled ruby-mysql 0.2.4 with mysql411 shim (see #440) to ruby-mysql 0.2.6 with a patchset for 4.1 protocol support.  Local change [301] is now a part of the main driver; reapplied local change [2182].  Removed GC.start from Result.free.  [tommy@tmtm.org, akuroda@gmail.com, Doug Fales <doug.fales@gmail.com>, Jeremy Kemper]
3955

3956 3957
* Correct handling of complex order clauses with SQL Server limit emulation.  #2770 [Tom Ward <tom@popdog.net>, Matt B.]

3958 3959
* Correct whitespace problem in Oracle default column value parsing.  #2788 [rick@rickbradley.com]

3960 3961
* Destroy associated has_and_belongs_to_many records after all before_destroy callbacks but before destroy.  This allows you to act on the habtm association as you please while preserving referential integrity.  #2065 [larrywilliams1@gmail.com, sam.kirchmeier@gmail.com, elliot@townx.org, Jeremy Kemper]

3962 3963
* Deprecate the old, confusing :exclusively_dependent option in favor of :dependent => :delete_all.  [Jeremy Kemper]

3964 3965 3966
* More compatible Oracle column reflection.  #2771 [Ryan Davis <ryand-ruby@zenspider.com>, Michael Schoen <schoenm@earthlink.net>]


3967
*1.13.0* (November 7th, 2005)
3968

3969 3970
* Fixed faulty regex in get_table_name method (SQLServerAdapter) #2639 [Ryan Tomayko]

3971
* Added :include as an option for association declarations [David Heinemeier Hansson]. Example:
3972 3973 3974

    has_many :posts, :include => [ :author, :comments ]

3975 3976 3977 3978 3979 3980 3981 3982 3983
* Rename Base.constrain to Base.with_scope so it doesn't conflict with existing concept of database constraints.  Make scoping more robust: uniform method => parameters, validated method names and supported finder parameters, raise exception on nested scopes.  [Jeremy Kemper]  Example:

    Comment.with_scope(:find => { :conditions => 'active=true' }, :create => { :post_id => 5 }) do
      # Find where name = ? and active=true
      Comment.find :all, :conditions => ['name = ?', name]
      # Create comment associated with :post_id
      Comment.create :body => "Hello world"
    end

3984 3985
* Fixed that SQL Server should ignore :size declarations on anything but integer and string in the agnostic schema representation #2756 [Ryan Tomayko]

3986
* Added constrain scoping for creates using a hash of attributes bound to the :creation key [David Heinemeier Hansson]. Example:
3987

3988 3989 3990 3991 3992 3993 3994 3995 3996
    Comment.constrain(:creation => { :post_id => 5 }) do
      # Associated with :post_id
      Comment.create :body => "Hello world"
    end
  
  This is rarely used directly, but allows for find_or_create on associations. So you can do:
  
    # If the tag doesn't exist, a new one is created that's associated with the person
    person.tags.find_or_create_by_name("Summer")
3997

3998
* Added find_or_create_by_X as a second type of dynamic finder that'll create the record if it doesn't already exist [David Heinemeier Hansson]. Example:
3999

4000 4001 4002 4003 4004
    # No 'Summer' tag exists
    Tag.find_or_create_by_name("Summer") # equal to Tag.create(:name => "Summer")
    
    # Now the 'Summer' tag does exist
    Tag.find_or_create_by_name("Summer") # equal to Tag.find_by_name("Summer")
4005

4006
* Added extension capabilities to has_many and has_and_belongs_to_many proxies [David Heinemeier Hansson]. Example:
4007 4008

    class Account < ActiveRecord::Base
4009
      has_many :people do
4010 4011 4012
        def find_or_create_by_name(name)
          first_name, *last_name = name.split
          last_name = last_name.join " "
4013 4014

          find_or_create_by_first_name_and_last_name(first_name, last_name)
4015
        end
4016
      end
4017
    end
4018

4019 4020 4021
    person = Account.find(:first).people.find_or_create_by_name("David Heinemeier Hansson")
    person.first_name # => "David"
    person.last_name  # => "Heinemeier Hansson"
4022

4023
  Note that the anoymous module must be declared using brackets, not do/end (due to order of evaluation).
4024

4025
* Omit internal dtproperties table from SQLServer table list.  #2729 [Ryan Tomayko]
4026

4027
* Quote column names in generated SQL.  #2728 [Ryan Tomayko]
4028 4029 4030 4031 4032 4033

* Correct the pure-Ruby MySQL 4.1.1 shim's version test.  #2718 [Jeremy Kemper]

* Add Model.create! to match existing model.save! method.  When save! raises RecordInvalid, you can catch the exception, retrieve the invalid record (invalid_exception.record), and see its errors (invalid_exception.record.errors).  [Jeremy Kemper]

* Correct fixture behavior when table name pluralization is off.  #2719 [Rick Bradley <rick@rickbradley.com>]
4034

4035 4036
* Changed :dbfile to :database for SQLite adapter for consistency (old key still works as an alias) #2644 [Dan Peterson]

4037 4038
* Added migration support for Oracle #2647 [Michael Schoen]

4039 4040
* Worked around that connection can't be reset if allow_concurrency is off.  #2648 [Michael Schoen <schoenm@earthlink.net>]

4041
* Fixed SQL Server adapter to pass even more tests and do even better #2634 [Ryan Tomayko]
4042 4043 4044

* Fixed SQL Server adapter so it honors options[:conditions] when applying :limits #1978 [Tom Ward]

4045 4046
* Added migration support to SQL Server adapter (please someone do the same for Oracle and DB2) #2625 [Tom Ward]

4047 4048
* Use AR::Base.silence rather than AR::Base.logger.silence in fixtures to preserve Log4r compatibility.  #2618 [dansketcher@gmail.com]

4049 4050 4051
* Constraints are cloned so they can't be inadvertently modified while they're
in effect.  Added :readonly finder constraint.  Calling an association collection's class method (Part.foobar via item.parts.foobar) constrains :readonly => false since the collection's :joins constraint would otherwise force it to true.  [Jeremy Kemper <rails@bitsweat.net>]

4052 4053
* Added :offset and :limit to the kinds of options that Base.constrain can use #2466 [duane.johnson@gmail.com]

4054
* Fixed handling of nil number columns on Oracle and cleaned up tests for Oracle in general #2555 [Michael Schoen]
4055

4056
* Added quoted_true and quoted_false methods and tables to db2_adapter and cleaned up tests for DB2 #2493, #2624 [maik schmidt]
4057 4058


4059
*1.12.2* (October 26th, 2005)
4060

4061
* Allow symbols to rename columns when using SQLite adapter. #2531 [Kevin Clark]
4062

4063
* Map Active Record time to SQL TIME.  #2575, #2576 [Robby Russell <robby@planetargon.com>]
4064

4065
* Clarify semantics of ActiveRecord::Base#respond_to?  #2560 [Stefan Kaes]
4066

4067 4068 4069
* Fixed Association#clear for associations which have not yet been accessed. #2524 [Patrick Lenz <patrick@lenz.sh>]

* HABTM finders shouldn't return readonly records.  #2525 [Patrick Lenz <patrick@lenz.sh>]
4070

M
Marcel Molina 已提交
4071 4072
* Make all tests runnable on their own. #2521. [Blair Zajac <blair@orcaware.com>]

4073

4074 4075
*1.12.1* (October 19th, 2005)

J
Jeremy Kemper 已提交
4076 4077
* Always parenthesize :conditions options so they may be safely combined with STI and constraints.

4078 4079
* Correct PostgreSQL primary key sequence detection.  #2507 [tmornini@infomania.com]

4080 4081
* Added support for using limits in eager loads that involve has_many and has_and_belongs_to_many associations

4082

4083
*1.12.0* (October 16th, 2005)
4084

4085 4086
* Update/clean up documentation (rdoc)

4087 4088
* PostgreSQL sequence support.  Use set_sequence_name in your model class to specify its primary key sequence.  #2292 [Rick Olson <technoweenie@gmail.com>, Robby Russell <robby@planetargon.com>]

4089 4090
* Change default logging colors to work on both white and black backgrounds. [Sam Stephenson]

4091
* YAML fixtures support ordered hashes for fixtures with foreign key dependencies in the same table.  #1896 [purestorm@ggnore.net]
4092 4093

* :dependent now accepts :nullify option. Sets the foreign key of the related objects to NULL instead of deleting them. #2015 [Robby Russell <robby@planetargon.com>] 
4094

4095 4096
* Introduce read-only records.  If you call object.readonly! then it will mark the object as read-only and raise ReadOnlyRecord if you call object.save.  object.readonly? reports whether the object is read-only.  Passing :readonly => true to any finder method will mark returned records as read-only.  The :joins option now implies :readonly, so if you use this option, saving the same record will now fail.  Use find_by_sql to work around.

4097
* Avoid memleak in dev mode when using fcgi
4098 4099

* Simplified .clear on active record associations by using the existing delete_records method. #1906 [Caleb <me@cpb.ca>]
4100

4101 4102
* Delegate access to a customized primary key to the conventional id method. #2444. [Blair Zajac <blair@orcaware.com>]

4103 4104
* Fix errors caused by assigning a has-one or belongs-to property to itself

4105 4106
* Add ActiveRecord::Base.schema_format setting which specifies how databases should be dumped [Sam Stephenson]

M
Marcel Molina 已提交
4107 4108
* Update DB2 adapter. #2206. [contact@maik-schmidt.de]

4109 4110
* Corrections to SQLServer native data types. #2267.  [rails.20.clarry@spamgourmet.com]

4111 4112
* Deprecated ActiveRecord::Base.threaded_connection in favor of ActiveRecord::Base.allow_concurrency.

4113 4114
* Protect id attribute from mass assigment even when the primary key is set to something else. #2438. [Blair Zajac <blair@orcaware.com>]

4115 4116
* Misc doc fixes (typos/grammar/etc.). #2430. [coffee2code]

4117 4118
* Add test coverage for content_columns. #2432. [coffee2code]

4119
* Speed up for unthreaded environments. #2431. [Stefan Kaes]
4120

4121
* Optimization for Mysql selects using mysql-ruby extension greater than 2.6.3.  #2426. [Stefan Kaes]
4122

4123
* Speed up the setting of table_name. #2428. [Stefan Kaes]
4124

4125
* Optimize instantiation of STI subclass records. In partial fullfilment of #1236. [Stefan Kaes]
4126

4127 4128
* Fix typo of 'constrains' to 'contraints'. #2069. [Michael Schuerig <michael@schuerig.de>]

4129
* Optimization refactoring for add_limit_offset!. In partial fullfilment of #1236. [Stefan Kaes]
4130

4131 4132
* Add ability to get all siblings, including the current child, with acts_as_tree. Recloses #2140. [Michael Schuerig <michael@schuerig.de>]

4133
* Add geometric type for postgresql adapter. #2233 [Andrew Kaspick]
4134

4135
* Add option (true by default) to generate reader methods for each attribute of a record to avoid the overhead of calling method missing. In partial fullfilment of #1236. [Stefan Kaes]
4136

4137
* Add convenience predicate methods on Column class. In partial fullfilment of #1236. [Stefan Kaes]
4138

4139 4140
* Raise errors when invalid hash keys are passed to ActiveRecord::Base.find. #2363  [Chad Fowler <chad@chadfowler.com>, Nicholas Seckar]

4141 4142
* Added :force option to create_table that'll try to drop the table if it already exists before creating

4143 4144
* Fix transactions so that calling return while inside a transaction will not leave an open transaction on the connection. [Nicholas Seckar]

4145 4146
* Use foreign_key inflection uniformly.  #2156 [Blair Zajac <blair@orcaware.com>]

4147 4148
* model.association.clear should destroy associated objects if :dependent => true instead of nullifying their foreign keys.  #2221 [joergd@pobox.com, ObieFernandez <obiefernandez@gmail.com>]

4149 4150
* Returning false from before_destroy should cancel the action.  #1829 [Jeremy Huffman]

4151 4152
* Recognize PostgreSQL NOW() default as equivalent to CURRENT_TIMESTAMP or CURRENT_DATE, depending on the column's type.  #2256 [mat <mat@absolight.fr>]

J
Jeremy Kemper 已提交
4153 4154
* Extensive documentation for the abstract database adapter.  #2250 [François Beausoleil <fbeausoleil@ftml.net>]

4155
* Clean up Fixtures.reset_sequences for PostgreSQL.  Handle tables with no rows and models with custom primary keys.  #2174, #2183 [jay@jay.fm, Blair Zajac <blair@orcaware.com>]
4156

4157 4158
* Improve error message when nil is assigned to an attr which validates_size_of within a range.  #2022 [Manuel Holtgrewe <purestorm@ggnore.net>]

4159 4160 4161
* Make update_attribute use the same writer method that update_attributes uses.
 #2237 [trevor@protocool.com]

4162
* Make migrations honor table name prefixes and suffixes. #2298 [Jakob Skjerning, Marcel Molina Jr.]
4163

4164 4165
* Correct and optimize PostgreSQL bytea escaping.  #1745, #1837 [dave@cherryville.org, ken@miriamtech.com, bellis@deepthought.org]

4166 4167
* Fixtures should only reset a PostgreSQL sequence if it corresponds to an integer primary key named id.  #1749 [chris@chrisbrinker.com]

4168 4169
* Standardize the interpretation of boolean columns in the Mysql and Sqlite adapters. (Use MysqlAdapter.emulate_booleans = false to disable this behavior)

4170
* Added new symbol-driven approach to activating observers with Base#observers= [David Heinemeier Hansson]. Example:
4171

4172
    ActiveRecord::Base.observers = :cacher, :garbage_collector
4173

4174 4175 4176 4177 4178 4179 4180
* Added AbstractAdapter#select_value and AbstractAdapter#select_values as convenience methods for selecting single values, instead of hashes, of the first column in a SELECT #2283 [solo@gatelys.com]

* Wrap :conditions in parentheses to prevent problems with OR's #1871 [Jamis Buck]

* Allow the postgresql adapter to work with the SchemaDumper. [Jamis Buck]

* Add ActiveRecord::SchemaDumper for dumping a DB schema to a pure-ruby file, making it easier to consolidate large migration lists and port database schemas between databases. [Jamis Buck]
4181

4182 4183
* Fixed migrations for Windows when using more than 10 [David Naseby]

4184 4185
* Fixed that the create_x method from belongs_to wouldn't save the association properly #2042 [Florian Weber]

4186
* Fixed saving a record with two unsaved belongs_to associations pointing to the same object #2023 [Tobias Lütke]
4187

4188 4189
* Improved migrations' behavior when the schema_info table is empty. [Nicholas Seckar]

4190 4191
* Fixed that Observers didn't observe sub-classes #627 [Florian Weber]

4192
* Fix eager loading error messages, allow :include to specify tables using strings or symbols. Closes #2222 [Marcel Molina Jr.]
4193

4194
* Added check for RAILS_CONNECTION_ADAPTERS on startup and only load the connection adapters specified within if its present (available in Rails through config.connection_adapters using the new config) #1958 [skae]
4195

4196 4197
* Fixed various problems with has_and_belongs_to_many when using customer finder_sql #2094 [Florian Weber]

4198
* Added better exception error when unknown column types are used with migrations #1814 [François Beausoleil]
4199

4200 4201
* Fixed "connection lost" issue with the bundled Ruby/MySQL driver (would kill the app after 8 hours of inactivity) #2163, #428 [kajism@yahoo.com]

4202 4203
* Fixed comparison of Active Record objects so two new objects are not equal #2099 [deberg]

4204 4205
* Fixed that the SQL Server adapter would sometimes return DBI::Timestamp objects instead of Time #2127 [Tom Ward]

4206 4207
* Added the instance methods #root and #ancestors on acts_as_tree and fixed siblings to not include the current node #2142, #2140 [coffee2code]

4208 4209 4210
* Fixed that Active Record would call SHOW FIELDS twice (or more) for the same model when the cached results were available #1947 [sd@notso.net]

* Added log_level and use_silence parameter to ActiveRecord::Base.benchmark. The first controls at what level the benchmark statement will be logged (now as debug, instead of info) and the second that can be passed false to include all logging statements during the benchmark block/
4211

4212 4213
* Make sure the schema_info table is created before querying the current version #1903

4214
* Fixtures ignore table name prefix and suffix #1987 [Jakob Skjerning]
4215

4216
* Add documentation for index_type argument to add_index method for migrations #2005 [Blaine]
4217

4218 4219
* Modify read_attribute to allow a symbol argument #2024 [Ken Kunz]

4220
* Make destroy return self #1913 [Sebastian Kanthak]
J
Jamis Buck 已提交
4221

4222 4223
* Fix typo in validations documentation #1938 [court3nay]

4224 4225
* Make acts_as_list work for insert_at(1) #1966 [hensleyl@papermountain.org]

4226 4227
* Fix typo in count_by_sql documentation #1969 [Alexey Verkhovsky]

4228 4229
* Allow add_column and create_table to specify NOT NULL #1712 [emptysands@gmail.com]

4230 4231
* Fix create_table so that id column is implicitly added [Rick Olson]

4232 4233 4234 4235 4236 4237 4238 4239 4240 4241
* Default sequence names for Oracle changed to #{table_name}_seq, which is the most commonly used standard. In addition, a new method ActiveRecord::Base#set_sequence_name allows the developer to set the sequence name per model. This is a non-backwards-compatible change -- anyone using the old-style "rails_sequence" will need to either create new sequences, or set: ActiveRecord::Base.set_sequence_name = "rails_sequence" #1798

* OCIAdapter now properly handles synonyms, which are commonly used to separate out the schema owner from the application user #1798

* Fixed the handling of camelCase columns names in Oracle #1798

* Implemented for OCI the Rakefile tasks of :clone_structure_to_test, :db_structure_dump, and :purge_test_database, which enable Oracle folks to enjoy all the agile goodness of Rails for testing. Note that the current implementation is fairly limited -- only tables and sequences are cloned, not constraints or indexes. A full clone in Oracle generally requires some manual effort, and is version-specific. Post 9i, Oracle recommends the use of the DBMS_METADATA package, though that approach requires editing of the physical characteristics generated #1798

* Fixed the handling of multiple blob columns in Oracle if one or more of them are null #1798

4242
* Added support for calling constrained class methods on has_many and has_and_belongs_to_many collections #1764 [Tobias Lütke]
4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254

    class Comment < AR:B
      def self.search(q)
        find(:all, :conditions => ["body = ?", q])
      end
    end 

    class Post < AR:B
      has_many :comments
    end

    Post.find(1).comments.search('hi') # => SELECT * from comments WHERE post_id = 1 AND body = 'hi'
4255 4256 4257 4258 4259
  
  NOTICE: This patch changes the underlying SQL generated by has_and_belongs_to_many queries. If your relying on that, such as
  by explicitly referencing the old t and j aliases, you'll need to update your code. Of course, you _shouldn't_ be relying on
  details like that no less than you should be diving in to touch private variables. But just in case you do, consider yourself
  noticed :)
4260

4261 4262
* Added migration support for SQLite (using temporary tables to simulate ALTER TABLE) #1771 [Sam Stephenson]

4263 4264
* Remove extra definition of supports_migrations? from abstract_adaptor.rb [Nicholas Seckar]

4265 4266
* Fix acts_as_list so that moving next-to-last item to the bottom does not result in duplicate item positions

4267 4268
* Fixed incompatibility in DB2 adapter with the new limit/offset approach #1718 [Maik Schmidt]

4269 4270 4271
* Added :select option to find which can specify a different value than the default *, like find(:all, :select => "first_name, last_name"), if you either only want to select part of the columns or exclude columns otherwise included from a join #1338 [Stefan Kaes]


4272
*1.11.1* (11 July, 2005)
4273

4274
* Added support for limit and offset with eager loading of has_one and belongs_to associations. Using the options with has_many and has_and_belongs_to_many associations will now raise an ActiveRecord::ConfigurationError #1692 [Rick Olson]
4275

4276 4277
* Fixed that assume_bottom_position (in acts_as_list) could be called on items already last in the list and they would move one position away from the list #1648 [tyler@kianta.com]

4278 4279
* Added ActiveRecord::Base.threaded_connections flag to turn off 1-connection per thread (required for thread safety). By default it's on, but WEBrick in Rails need it off #1685 [Sam Stephenson]

4280
* Correct reflected table name for singular associations.  #1688 [court3nay]
4281

4282 4283
* Fixed optimistic locking with SQL Server #1660 [tom@popdog.net]

4284 4285
* Added ActiveRecord::Migrator.migrate that can figure out whether to go up or down based on the target version and the current

4286
* Added better error message for "packets out of order" #1630 [court3nay]
4287

4288 4289 4290
* Fixed first run of "rake migrate" on PostgreSQL by not expecting a return value on the id #1640


4291
*1.11.0* (6 July, 2005)
4292

4293 4294
* Fixed that Yaml error message in fixtures hid the real error #1623 [Nicholas Seckar]

4295 4296
* Changed logging of SQL statements to use the DEBUG level instead of INFO

4297
* Added new Migrations framework for describing schema transformations in a way that can be easily applied across multiple databases #1604 [Tobias Lütke] See documentation under ActiveRecord::Migration and the additional support in the Rails rakefile/generator.
4298

4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311
* Added callback hooks to association collections #1549 [Florian Weber]. Example:

    class Project
      has_and_belongs_to_many :developers, :before_add => :evaluate_velocity
    
      def evaluate_velocity(developer)
        ...
      end
    end 
  
  ..raising an exception will cause the object not to be added (or removed, with before_remove).
    

4312 4313
* Fixed Base.content_columns call for SQL Server adapter #1450 [DeLynn Berry]

4314 4315
* Fixed Base#write_attribute to work with both symbols and strings #1190 [Paul Legato]

4316 4317
* Fixed that has_and_belongs_to_many didn't respect single table inheritance types #1081 [Florian Weber]

4318 4319
* Speed up ActiveRecord#method_missing for the common case (read_attribute).

4320
* Only notify observers on after_find and after_initialize if these methods are defined on the model.  #1235 [Stefan Kaes]
4321

4322 4323
* Fixed that single-table inheritance sub-classes couldn't be used to limit the result set with eager loading #1215 [Chris McGrath]

4324 4325
* Fixed validates_numericality_of to work with overrided getter-method when :allow_nil is on #1316 [raidel@onemail.at]

4326
* Added roots, root, and siblings to the batch of methods added by acts_as_tree #1541 [Michael Schuerig]
4327

4328 4329 4330 4331
* Added support for limit/offset with the MS SQL Server driver so that pagination will now work #1569 [DeLynn Berry]

* Added support for ODBC connections to MS SQL Server so you can connect from a non-Windows machine #1569 [Mark Imbriaco/DeLynn Berry]

4332 4333
* Fixed that multiparameter posts ignored attr_protected #1532 [alec+rails@veryclever.net]

4334 4335
* Fixed problem with eager loading when using a has_and_belongs_to_many association using :association_foreign_key #1504 [flash@vanklinkenbergsoftware.nl]

4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347
* Fixed Base#find to honor the documentation on how :joins work and make them consistent with Base#count #1405 [pritchie@gmail.com]. What used to be:

    Developer.find :all, :joins => 'developers_projects', :conditions => 'id=developer_id AND project_id=1'
  
  ...should instead be:
  
    Developer.find(
      :all, 
      :joins => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id', 
      :conditions => 'project_id=1'
    )    

4348
* Fixed that validations didn't respecting custom setting for too_short, too_long messages #1437 [Marcel Molina Jr.]
4349

4350 4351
* Fixed that clear_association_cache doesn't delete new associations on new records (so you can safely place new records in the session with Action Pack without having new associations wiped) #1494 [cluon]

4352 4353
* Fixed that calling Model.find([]) returns [] and doesn't throw an exception #1379

4354 4355
* Fixed that adding a record to a has_and_belongs_to collection would always save it -- now it only saves if its a new record #1203 [Alisdair McDiarmid]

4356 4357
* Fixed saving of in-memory association structures to happen as a after_create/after_update callback instead of after_save -- that way you can add new associations in after_create/after_update callbacks without getting them saved twice

4358
* Allow any Enumerable, not just Array, to work as bind variables #1344 [Jeremy Kemper]
4359

4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372
* Added actual database-changing behavior to collection assigment for has_many and has_and_belongs_to_many #1425 [Sebastian Kanthak].
  Example:

    david.projects = [Project.find(1), Project.new("name" => "ActionWebSearch")]
    david.save
  
  If david.projects already contain the project with ID 1, this is left unchanged. Any other projects are dropped. And the new
  project is saved when david.save is called.
  
  Also included is a way to do assignments through IDs, which is perfect for checkbox updating, so you get to do:
  
    david.project_ids = [1, 5, 7]

4373 4374
* Corrected typo in find SQL for has_and_belongs_to_many.  #1312 [ben@bensinclair.com]

4375
* Fixed sanitized conditions for has_many finder method.  #1281 [jackc@hylesanderson.com, pragdave, Tobias Lütke]
4376

4377 4378
* Comprehensive PostgreSQL schema support.  Use the optional schema_search_path directive in database.yml to give a comma-separated list of schemas to search for your tables.  This allows you, for example, to have tables in a shared schema without having to use a custom table name.  See http://www.postgresql.org/docs/8.0/interactive/ddl-schemas.html to learn more.  #827 [dave@cherryville.org]

4379 4380
* Corrected @@configurations typo #1410 [david@ruppconsulting.com]

4381 4382
* Return PostgreSQL columns in the order they were declared #1374 [perlguy@gmail.com]

4383 4384
* Allow before/after update hooks to work on models using optimistic locking 

4385 4386
* Eager loading of dependent has_one associations won't delete the association #1212

4387 4388
* Added a second parameter to the build and create method for has_one that controls whether the existing association should be replaced (which means nullifying its foreign key as well). By default this is true, but false can be passed to prevent it.

4389 4390
* Using transactional fixtures now causes the data to be loaded only once.

4391 4392 4393 4394 4395 4396 4397 4398
* Added fixture accessor methods that can be used when instantiated fixtures are disabled.

    fixtures :web_sites

    def test_something
      assert_equal "Ruby on Rails", web_sites(:rubyonrails).name
    end

4399 4400 4401 4402
* Added DoubleRenderError exception that'll be raised if render* is called twice #518 [Nicholas Seckar]

* Fixed exceptions occuring after render has been called #1096 [Nicholas Seckar]

4403 4404 4405 4406
* CHANGED: validates_presence_of now uses Errors#add_on_blank, which will make "  " fail the validation where it didn't before #1309

* Added Errors#add_on_blank which works like Errors#add_on_empty, but uses Object#blank? instead

4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417
* Added the :if option to all validations that can either use a block or a method pointer to determine whether the validation should be run or not. #1324 [Duane Johnson/jhosteny]. Examples:

  Conditional validations such as the following are made possible:
    validates_numericality_of :income, :if => :employed?

  Conditional validations can also solve the salted login generator problem:
    validates_confirmation_of :password, :if => :new_password?
  
  Using blocks:
    validates_presence_of :username, :if => Proc.new { |user| user.signup_step > 1 }

4418 4419
* Fixed use of construct_finder_sql when using :join #1288 [dwlt@dwlt.net]

4420 4421
* Fixed that :delete_sql in has_and_belongs_to_many associations couldn't access record properties #1299 [Rick Olson]

4422
* Fixed that clone would break when an aggregate had the same name as one of its attributes #1307 [Jeremy Kemper]
D
David Heinemeier Hansson 已提交
4423

4424 4425
* Changed that destroying an object will only freeze the attributes hash, which keeps the object from having attributes changed (as that wouldn't make sense), but allows for the querying of associations after it has been destroyed.

4426 4427
* Changed the callbacks such that observers are notified before the in-object callbacks are triggered. Without this change, it wasn't possible to act on the whole object in something like a before_destroy observer without having the objects own callbacks (like deleting associations) called first.

4428 4429 4430 4431 4432
* Added option for passing an array to the find_all version of the dynamic finders and have it evaluated as an IN fragment. Example:

    # SELECT * FROM topics WHERE title IN ('First', 'Second')
    Topic.find_all_by_title(["First", "Second"])

4433
* Added compatibility with camelCase column names for dynamic finders #533 [Dee Zsombor]
4434

4435
* Fixed extraneous comma in count() function that made it not work with joins #1156 [Jarkko Laine/Dee Zsombor]
4436

4437 4438
* Fixed incompatibility with Base#find with an array of ids that would fail when using eager loading #1186 [Alisdair McDiarmid]

4439 4440
* Fixed that validate_length_of lost :on option when :within was specified #1195 [jhosteny@mac.com]

4441
* Added encoding and min_messages options for PostgreSQL #1205 [Shugo Maeda]. Configuration example:
4442 4443 4444 4445 4446 4447 4448 4449 4450 4451

    development:
      adapter: postgresql
      database: rails_development
      host: localhost
      username: postgres
      password:
      encoding: UTF8
      min_messages: ERROR

4452 4453
* Fixed acts_as_list where deleting an item that was removed from the list would ruin the positioning of other list items #1197 [Jamis Buck]

4454 4455 4456 4457 4458
* Added validates_exclusion_of as a negative of validates_inclusion_of

* Optimized counting of has_many associations by setting the association to empty if the count is 0 so repeated calls doesn't trigger database calls


4459 4460
*1.10.1* (20th April, 2005)

4461 4462
* Fixed frivilous database queries being triggered with eager loading on empty associations and other things

4463
* Fixed order of loading in eager associations
4464 4465 4466 4467

* Fixed stray comma when using eager loading and ordering together from has_many associations #1143


4468
*1.10.0* (19th April, 2005)
4469

4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491
* Added eager loading of associations as a way to solve the N+1 problem more gracefully without piggy-back queries. Example:

    for post in Post.find(:all, :limit => 100)
      puts "Post:            " + post.title
      puts "Written by:      " + post.author.name
      puts "Last comment on: " + post.comments.first.created_on
    end
  
  This used to generate 301 database queries if all 100 posts had both author and comments. It can now be written as:
  
    for post in Post.find(:all, :limit => 100, :include => [ :author, :comments ])
 
  ...and the number of database queries needed is now 1.

* Added new unified Base.find API and deprecated the use of find_first and find_all. See the documentation for Base.find. Examples:

    Person.find(1, :conditions => "administrator = 1", :order => "created_on DESC")
    Person.find(1, 5, 6, :conditions => "administrator = 1", :order => "created_on DESC")
    Person.find(:first, :order => "created_on DESC", :offset => 5)
    Person.find(:all, :conditions => [ "category IN (?)", categories], :limit => 50)
    Person.find(:all, :offset => 10, :limit => 10)

4492 4493 4494 4495 4496 4497 4498
* Added acts_as_nested_set #1000 [wschenk]. Introduction:

    This acts provides Nested Set functionality.  Nested Set is similiar to Tree, but with
    the added feature that you can select the children and all of it's descendants with
    a single query.  A good use case for this is a threaded post system, where you want
    to display every reply to a comment without multiple selects.

4499
* Added Base.save! that attempts to save the record just like Base.save but will raise a RecordInvalid exception instead of returning false if the record is not valid [Dave Thomas]
4500

4501 4502
* Fixed PostgreSQL usage of fixtures with regards to public schemas and table names with dots #962 [gnuman1@gmail.com]

4503 4504
* Fixed that fixtures were being deleted in the same order as inserts causing FK errors #890 [andrew.john.peters@gmail.com]

4505 4506
* Fixed loading of fixtures in to be in the right order (or PostgreSQL would bark) #1047 [stephenh@chase3000.com]

4507 4508
* Fixed page caching for non-vhost applications living underneath the root #1004 [Ben Schumacher]

4509 4510
* Fixes a problem with the SQL Adapter which was resulting in IDENTITY_INSERT not being set to ON when it should be #1104 [adelle]

4511 4512
* Added the option to specify the acceptance string in validates_acceptance_of #1106 [caleb@aei-tech.com]

4513 4514
* Added insert_at(position) to acts_as_list #1083 [DeLynnB]

4515 4516
* Removed the default order by id on has_and_belongs_to_many queries as it could kill performance on large sets (you can still specify by hand with :order)

4517 4518
* Fixed that Base.silence should restore the old logger level when done, not just set it to DEBUG #1084 [yon@milliped.com]

4519 4520
* Fixed boolean saving on Oracle #1093 [mparrish@pearware.org]

4521 4522
* Moved build_association and create_association for has_one and belongs_to out of deprecation as they work when the association is nil unlike association.build and association.create, which require the association to be already in place #864

4523 4524
* Added rollbacks of transactions if they're active as the dispatcher is killed gracefully (TERM signal) #1054 [Leon Bredt]

4525 4526
* Added quoting of column names for fixtures #997 [jcfischer@gmail.com]

4527 4528
* Fixed counter_sql when no records exist in database for PostgreSQL (would give error, not 0) #1039 [Caleb Tennis]

4529
* Fixed that benchmarking times for rendering included db runtimes #987 [Stefan Kaes]
4530

4531 4532
* Fixed boolean queries for t/f fields in PostgreSQL #995 [dave@cherryville.org]

4533
* Added that model.items.delete(child) will delete the child, not just set the foreign key to nil, if the child is dependent on the model #978 [Jeremy Kemper]
4534

4535 4536
* Fixed auto-stamping of dates (created_on/updated_on) for PostgreSQL #985 [dave@cherryville.org]

4537
* Fixed Base.silence/benchmark to only log if a logger has been configured #986 [Stefan Kaes]
4538

4539
* Added a join parameter as the third argument to Base.find_first and as the second to Base.count #426, #988 [Stefan Kaes]
4540

4541 4542
* Fixed bug in Base#hash method that would treat records with the same string-based id as different [Dave Thomas]

4543 4544 4545
* Renamed DateHelper#distance_of_time_in_words_to_now to DateHelper#time_ago_in_words (old method name is still available as a deprecated alias)


4546 4547 4548
*1.9.1* (27th March, 2005)

* Fixed that Active Record objects with float attribute could not be cloned #808
4549

4550 4551
* Fixed that MissingSourceFile's wasn't properly detected in production mode #925 [Nicholas Seckar]

4552 4553
* Fixed that :counter_cache option would look for a line_items_count column for a LineItem object instead of lineitems_count

4554 4555
* Fixed that AR exists?() would explode on postgresql if the passed id did not match the PK type #900 [Scott Barron]

4556 4557 4558
* Fixed the MS SQL adapter to work with the new limit/offset approach and with binary data (still suffering from 7KB limit, though) #901 [delynnb]


4559
*1.9.0* (22th March, 2005)
4560

4561 4562 4563 4564 4565 4566 4567
* Added adapter independent limit clause as a two-element array with the first being the limit, the second being the offset #795 [Sam Stephenson]. Example:

    Developer.find_all nil, 'id ASC', 5      # return the first five developers 
    Developer.find_all nil, 'id ASC', [3, 8] # return three developers, starting from #8 and forward
    
  This doesn't yet work with the DB2 or MS SQL adapters. Patches to make that happen are encouraged. 

4568 4569
* Added alias_method :to_param, :id to Base, such that Active Record objects to be used as URL parameters in Action Pack automatically #812 [Nicholas Seckar/Sam Stephenson]

4570 4571
* Improved the performance of the OCI8 adapter for Oracle #723 [pilx/gjenkins]

4572 4573
* Added type conversion before saving a record, so string-based values like "10.0" aren't left for the database to convert #820 [dave@cherryville.org]

4574 4575
* Added with additional settings for working with transactional fixtures and pre-loaded test databases #865 [mindel]

4576 4577
* Fixed acts_as_list to trigger remove_from_list on destroy after the fact, not before, so a unique position can be maintained #871 [Alisdair McDiarmid]

4578 4579
* Added the possibility of specifying fixtures in multiple calls #816 [kim@tinker.com]

4580 4581
* Added Base.exists?(id) that'll return true if an object of the class with the given id exists #854 [stian@grytoyr.net]

4582 4583 4584 4585
* Added optionally allow for nil or empty strings with validates_numericality_of #801 [Sebastian Kanthak]

* Fixed problem with using slashes in validates_format_of regular expressions #801 [Sebastian Kanthak]

4586 4587
* Fixed that SQLite3 exceptions are caught and reported properly #823 [yerejm]

4588 4589
* Added that all types of after_find/after_initialized callbacks are triggered if the explicit implementation is present, not only the explicit implementation itself

4590 4591 4592
* Fixed that symbols can be used on attribute assignment, like page.emails.create(:subject => data.subject, :body => data.body)


4593
*1.8.0* (7th March, 2005)
4594

4595 4596
* Added ActiveRecord::Base.colorize_logging to control whether to use colors in logs or not (on by default)

4597 4598
* Added support for timestamp with time zone in PostgreSQL #560 [Scott Barron]

4599 4600 4601 4602 4603 4604 4605 4606 4607 4608
* Added MultiparameterAssignmentErrors and AttributeAssignmentError exceptions #777 [demetrius]. Documentation:

   * +MultiparameterAssignmentErrors+ -- collection of errors that occurred during a mass assignment using the 
     +attributes=+ method. The +errors+ property of this exception contains an array of +AttributeAssignmentError+ 
     objects that should be inspected to determine which attributes triggered the errors.
   * +AttributeAssignmentError+ -- an error occurred while doing a mass assignment through the +attributes=+ method.
     You can inspect the +attribute+ property of the exception object to determine which attribute triggered the error.

* Fixed that postgresql adapter would fails when reading bytea fields with null value #771 [rodrigo k]

4609
* Added transactional fixtures that uses rollback to undo changes to fixtures instead of DELETE/INSERT -- it's much faster. See documentation under Fixtures #760 [Jeremy Kemper]
4610

4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624
* Added destruction of dependent objects in has_one associations when a new assignment happens #742 [mindel]. Example:

    class Account < ActiveRecord::Base
      has_one :credit_card, :dependent => true
    end
    class CreditCard < ActiveRecord::Base
      belongs_to :account
    end

    account.credit_card # => returns existing credit card, lets say id = 12
    account.credit_card = CreditCard.create("number" => "123")
    account.save # => CC with id = 12 is destroyed


4625
* Added validates_numericality_of #716 [Sebastian Kanthak/Chris McGrath]. Docuemntation:
4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640

    Validates whether the value of the specified attribute is numeric by trying to convert it to
    a float with Kernel.Float (if <tt>integer</tt> is false) or applying it to the regular expression
    <tt>/^[\+\-]?\d+$/</tt> (if <tt>integer</tt> is set to true).
    
      class Person < ActiveRecord::Base
        validates_numericality_of :value, :on => :create
      end
    
    Configuration options:
    * <tt>message</tt> - A custom error message (default is: "is not a number")
    * <tt>on</tt> Specifies when this validation is active (default is :save, other options :create, :update)
    * <tt>only_integer</tt> Specifies whether the value has to be an integer, e.g. an integral value (default is false)
    

4641 4642
* Fixed that HasManyAssociation#count was using :finder_sql rather than :counter_sql if it was available #445 [Scott Barron]

4643 4644
* Added better defaults for composed_of, so statements like composed_of :time_zone, :mapping => %w( time_zone time_zone ) can be written without the mapping part (it's now assumed)

4645 4646 4647
* Added MacroReflection#macro which will return a symbol describing the macro used (like :composed_of or :has_many) #718, #248 [james@slashetc.com]


D
David Heinemeier Hansson 已提交
4648
*1.7.0* (24th February, 2005)
4649

4650 4651
* Changed the auto-timestamping feature to use ActiveRecord::Base.default_timezone instead of entertaining the parallel ActiveRecord::Base.timestamps_gmt method. The latter is now deprecated and will throw a warning on use (but still work) #710 [Jamis Buck]

4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669
* Added a OCI8-based Oracle adapter that has been verified to work with Oracle 8 and 9 #629 [Graham Jenkins]. Usage notes:

    1.  Key generation uses a sequence "rails_sequence" for all tables. (I couldn't find a simple
        and safe way of passing table-specific sequence information to the adapter.)
    2.  Oracle uses DATE or TIMESTAMP datatypes for both dates and times. Consequently I have had to
        resort to some hacks to get data converted to Date or Time in Ruby.
        If the column_name ends in _at (like created_at, updated_at) it's created as a Ruby Time. Else if the
        hours/minutes/seconds are 0, I make it a Ruby Date. Else it's a Ruby Time.
        This is nasty - but if you use Duck Typing you'll probably not care very much.
        In 9i it's tempting to map DATE to Date and TIMESTAMP to Time but I don't think that is
        valid - too many databases use DATE for both.
        Timezones and sub-second precision on timestamps are not supported.
    3.  Default values that are functions (such as "SYSDATE") are not supported. This is a
        restriction of the way active record supports default values.
    4.  Referential integrity constraints are not fully supported. Under at least
        some circumstances, active record appears to delete parent and child records out of
        sequence and out of transaction scope. (Or this may just be a problem of test setup.)

4670 4671
  The OCI8 driver can be retrieved from http://rubyforge.org/projects/ruby-oci8/

4672 4673
* Added option :schema_order to the PostgreSQL adapter to support the use of multiple schemas per database #697 [YuriSchimke]

4674 4675
* Optimized the SQL used to generate has_and_belongs_to_many queries by listing the join table first #693 [yerejm]

4676 4677
* Fixed that when using validation macros with a custom message, if you happened to use single quotes in the message string you would get a parsing error #657 [tonka]

4678 4679
* Fixed that Active Record would throw Broken Pipe errors with FCGI when the MySQL connection timed out instead of reconnecting #428 [Nicholas Seckar]

4680 4681
* Added options to specify an SSL connection for MySQL. Define the following attributes in the connection config (config/database.yml in Rails) to use it: sslkey, sslcert, sslca, sslcapath, sslcipher. To use SSL with no client certs, just set :sslca = '/dev/null'. http://dev.mysql.com/doc/mysql/en/secure-connections.html #604 [daniel@nightrunner.com]

4682 4683
* Added automatic dropping/creating of test tables for running the unit tests on all databases #587 [adelle@bullet.net.au]

4684 4685
* Fixed that find_by_* would fail when column names had numbers #670 [demetrius]

4686 4687 4688 4689 4690 4691 4692 4693 4694
* Fixed the SQL Server adapter on a bunch of issues #667 [DeLynn]

    1. Created a new columns method that is much cleaner. 
    2. Corrected a problem with the select and select_all methods 
       that didn't account for the LIMIT clause being passed into raw SQL statements. 
    3. Implemented the string_to_time method in order to create proper instances of the time class. 
    4. Added logic to the simplified_type method that allows the database to specify the scale of float data. 
    5. Adjusted the quote_column_name to account for the fact that MS SQL is bothered by a forward slash in the data string.

4695
* Fixed that the dynamic finder like find_all_by_something_boolean(false) didn't work #649 [lmarlow]
4696

4697
* Added validates_each that validates each specified attribute against a block #610 [Jeremy Kemper]. Example:
4698 4699 4700 4701 4702 4703 4704
    
    class Person < ActiveRecord::Base
      validates_each :first_name, :last_name do |record, attr|
        record.errors.add attr, 'starts with z.' if attr[0] == ?z
      end
    end

4705
* Added :allow_nil as an explicit option for validates_length_of, so unless that's set to true having the attribute as nil will also return an error if a range is specified as :within #610 [Jeremy Kemper]
4706

4707 4708 4709 4710 4711 4712 4713 4714
* Added that validates_* now accept blocks to perform validations #618 [Tim Bates]. Example:

    class Person < ActiveRecord::Base
      validate { |person| person.errors.add("title", "will never be valid") if SHOULD_NEVER_BE_VALID }
    end

* Addded validation for validate all the associated objects before declaring failure with validates_associated #618 [Tim Bates]

4715 4716 4717 4718 4719 4720 4721 4722
* Added keyword-style approach to defining the custom relational bindings #545 [Jamis Buck]. Example:

    class Project < ActiveRecord::Base
      primary_key "sysid"
      table_name "XYZ_PROJECT"
      inheritance_column { original_inheritance_column + "_id" }
    end

4723 4724 4725
* Fixed Base#clone for use with PostgreSQL #565 [hanson@surgery.wisc.edu]


4726
*1.6.0* (January 25th, 2005)
4727

4728 4729 4730 4731 4732 4733 4734 4735 4736 4737
* Added that has_many association build and create methods can take arrays of record data like Base#create and Base#build to build/create multiple records at once.

* Added that Base#delete and Base#destroy both can take an array of ids to delete/destroy #336

* Added the option of supplying an array of attributes to Base#create, so that multiple records can be created at once.

* Added the option of supplying an array of ids and attributes to Base#update, so that multiple records can be updated at once (inspired by #526/Duane Johnson). Example

    people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy"} }
    Person.update(people.keys, people.values)
D
 
David Heinemeier Hansson 已提交
4738

4739 4740
* Added ActiveRecord::Base.timestamps_gmt that can be set to true to make the automated timestamping use GMT instead of local time #520 [Scott Baron]

4741 4742
* Added that update_all calls sanitize_sql on its updates argument, so stuff like MyRecord.update_all(['time = ?', Time.now]) works #519 [notahat]

4743 4744
* Fixed that the dynamic finders didn't treat nil as a "IS NULL" but rather "= NULL" case #515 [Demetrius]

4745
* Added bind-named arrays for interpolating a group of ids or strings in conditions #528 [Jeremy Kemper]
4746

4747 4748
* Added that has_and_belongs_to_many associations with additional attributes also can be created between unsaved objects and only committed to the database when Base#save is called on the associator #524 [Eric Anderson]

4749 4750
* Fixed that records fetched with piggy-back attributes or through rich has_and_belongs_to_many associations couldn't be saved due to the extra attributes not part of the table #522 [Eric Anderson]

4751 4752
* Added mass-assignment protection for the inheritance column -- regardless of a custom column is used or not

4753 4754
* Fixed that association proxies would fail === tests like PremiumSubscription === @account.subscription

4755 4756
* Fixed that column aliases didn't work as expected with the new MySql411 driver #507 [Demetrius]

4757 4758 4759
* Fixed that find_all would produce invalid sql when called sequentialy #490 [Scott Baron]


4760
*1.5.1* (January 18th, 2005)
4761

4762 4763
* Fixed that the belongs_to and has_one proxy would fail a test like 'if project.manager' -- this unfortunately also means that you can't call methods like project.manager.build unless there already is a manager on the project #492 [Tim Bates]

4764 4765 4766
* Fixed that the Ruby/MySQL adapter wouldn't connect if the password was empty #503 [Pelle]


4767
*1.5.0* (January 17th, 2005)
4768

4769 4770
* Fixed that unit tests for MySQL are now run as the "rails" user instead of root #455 [Eric Hodel]

4771 4772 4773 4774 4775 4776 4777 4778 4779
* Added validates_associated that enables validation of objects in an unsaved association #398 [Tim Bates]. Example:

    class Book < ActiveRecord::Base
      has_many :pages
      belongs_to :library
    
      validates_associated :pages, :library
    end
    
4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812
* Added support for associating unsaved objects #402 [Tim Bates]. Rules that govern this addition:

    == Unsaved objects and associations
    
    You can manipulate objects and associations before they are saved to the database, but there is some special behaviour you should be
    aware of, mostly involving the saving of associated objects.
    
    === One-to-one associations
    
    * Assigning an object to a has_one association automatically saves that object, and the object being replaced (if there is one), in
      order to update their primary keys - except if the parent object is unsaved (new_record? == true).
    * If either of these saves fail (due to one of the objects being invalid) the assignment statement returns false and the assignment
      is cancelled.
    * If you wish to assign an object to a has_one association without saving it, use the #association.build method (documented below).
    * Assigning an object to a belongs_to association does not save the object, since the foreign key field belongs on the parent. It does
      not save the parent either.
    
    === Collections
    
    * Adding an object to a collection (has_many or has_and_belongs_to_many) automatically saves that object, except if the parent object
      (the owner of the collection) is not yet stored in the database.
    * If saving any of the objects being added to a collection (via #push or similar) fails, then #push returns false.
    * You can add an object to a collection without automatically saving it by using the #collection.build method (documented below).
    * All unsaved (new_record? == true) members of the collection are automatically saved when the parent is saved.

* Added replace to associations, so you can do project.manager.replace(new_manager) or project.milestones.replace(new_milestones) #402 [Tim Bates]

* Added build and create methods to has_one and belongs_to associations, so you can now do project.manager.build(attributes) #402 [Tim Bates]

* Added that if a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last. #402 [Tim Bates]

* Fixed that Base#== wouldn't work for multiple references to the same unsaved object #402 [Tim Bates]

4813 4814
* Fixed binary support for PostgreSQL #444 [alex@byzantine.no]

4815 4816 4817 4818 4819
* Added a differenciation between AssociationCollection#size and -length. Now AssociationCollection#size returns the size of the 
  collection by executing a SELECT COUNT(*) query if the collection hasn't been loaded and calling collection.size if it has. If 
  it's more likely than not that the collection does have a size larger than zero and you need to fetch that collection afterwards, 
  it'll take one less SELECT query if you use length.

4820 4821
* Added Base#attributes that returns a hash of all the attributes with their names as keys and clones of their objects as values #433 [atyp.de]

4822 4823
* Fixed that foreign keys named the same as the association would cause stack overflow #437 [Eric Anderson]

4824 4825
* Fixed default scope of acts_as_list from "1" to "1 = 1", so it'll work in PostgreSQL (among other places) #427 [Alexey]

4826 4827
* Added Base#reload that reloads the attributes of an object from the database #422 [Andreas Schwarz]

4828
* Added SQLite3 compatibility through the sqlite3-ruby adapter by Jamis Buck #381 [Jeremy Kemper]
4829

4830 4831
* Added support for the new protocol spoken by MySQL 4.1.1+ servers for the Ruby/MySQL adapter that ships with Rails #440 [Matt Mower] 

D
David Heinemeier Hansson 已提交
4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843
* Added that Observers can use the observes class method instead of overwriting self.observed_class().

    Before:
      class ListSweeper < ActiveRecord::Base
        def self.observed_class() [ List, Item ]
      end
    
    After:
      class ListSweeper < ActiveRecord::Base
        observes List, Item
      end

4844 4845
* Fixed that conditions in has_many and has_and_belongs_to_many should be interpolated just like the finder_sql is

4846 4847
* Fixed Base#update_attribute to be indifferent to whether a string or symbol is used to describe the name

4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864
* Added Base#toggle(attribute) and Base#toggle!(attribute) that makes it easier to flip a switch or flag.

    Before: topic.update_attribute(:approved, !approved?)
    After : topic.toggle!(:approved)

* Added Base#increment!(attribute) and Base#decrement!(attribute) that also saves the records. Example:

    page.views # => 1
    page.increment!(:views) # executes an UPDATE statement
    page.views # => 2
    
    page.increment(:views).increment!(:views)
    page.views # => 4

* Added Base#increment(attribute) and Base#decrement(attribute) that encapsulates the += 1 and -= 1 patterns.


4865
*1.4.0* (January 4th, 2005)
4866

4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881
* Added automated optimistic locking if the field <tt>lock_version</tt> is present.  Each update to the
  record increments the lock_version column and the locking facilities ensure that records instantiated twice
  will let the last one saved raise a StaleObjectError if the first was also updated. Example:
  
    p1 = Person.find(1)
    p2 = Person.find(1)
    
    p1.first_name = "Michael"
    p1.save
    
    p2.first_name = "should fail"
    p2.save # Raises a ActiveRecord::StaleObjectError
  
  You're then responsible for dealing with the conflict by rescuing the exception and either rolling back, merging,
  or otherwise apply the business logic needed to resolve the conflict.
4882

4883
  #384 [Michael Koziarski]
4884

4885 4886 4887 4888 4889 4890 4891 4892 4893 4894
* Added dynamic attribute-based finders as a cleaner way of getting objects by simple queries without turning to SQL. 
  They work by appending the name of an attribute to <tt>find_by_</tt>, so you get finders like <tt>Person.find_by_user_name,
  Payment.find_by_transaction_id</tt>. So instead of writing <tt>Person.find_first(["user_name = ?", user_name])</tt>, you just do
  <tt>Person.find_by_user_name(user_name)</tt>.
  
  It's also possible to use multiple attributes in the same find by separating them with "_and_", so you get finders like
  <tt>Person.find_by_user_name_and_password</tt> or even <tt>Payment.find_by_purchaser_and_state_and_country</tt>. So instead of writing
  <tt>Person.find_first(["user_name = ? AND password = ?", user_name, password])</tt>, you just do 
  <tt>Person.find_by_user_name_and_password(user_name, password)</tt>.

4895 4896 4897 4898
  While primarily a construct for easier find_firsts, it can also be used as a construct for find_all by using calls like 
  <tt>Payment.find_all_by_amount(50)</tt> that is turned into <tt>Payment.find_all(["amount = ?", 50])</tt>. This is something not as equally useful,
  though, as it's not possible to specify the order in which the objects are returned.

4899
* Added block-style for callbacks #332 [Jeremy Kemper].
4900 4901 4902 4903 4904 4905 4906

    Before:
      before_destroy(Proc.new{ |record| Person.destroy_all "firm_id = #{record.id}" })
    
    After:
      before_destroy { |record| Person.destroy_all "firm_id = #{record.id}" }

4907
* Added :counter_cache option to acts_as_tree that works just like the one you can define on belongs_to #371 [Josh Peek]
4908

4909 4910 4911
* Added Base.default_timezone accessor that determines whether to use Time.local (using :local) or Time.utc (using :utc) when pulling dates 
  and times from the database. This is set to :local by default.

4912 4913
* Added the possibility for adapters to overwrite add_limit! to implement a different limiting scheme than "LIMIT X" used by MySQL, PostgreSQL, and SQLite.

4914 4915 4916 4917 4918 4919
* Added the possibility of having objects with acts_as_list created before their scope is available or...

* Added a db2 adapter that only depends on the Ruby/DB2 bindings (http://raa.ruby-lang.org/project/ruby-db2/) #386 [Maik Schmidt]

* Added the final touches to the Microsoft SQL Server adapter by Joey Gibson that makes it suitable for actual use #394 [DeLynn Barry]

4920
* Added that Base#find takes an optional options hash, including :conditions. Base#find_on_conditions deprecated in favor of #find with :conditions #407 [Jeremy Kemper]
4921 4922 4923 4924 4925

* Added HasManyAssociation#count that works like Base#count #413 [intinig]

* Fixed handling of binary content in blobs and similar fields for Ruby/MySQL and SQLite #409 [xal]

4926
* Fixed a bug in the Ruby/MySQL that caused binary content to be escaped badly and come back mangled #405 [Tobias Lütke]
4927

4928
* Fixed that the const_missing autoload assumes the requested constant is set by require_association and calls const_get to retrieve it. 
4929
  If require_association did not set the constant then const_get will call const_missing, resulting in an infinite loop #380 [Jeremy Kemper]
4930

4931 4932 4933 4934 4935 4936 4937
* Fixed broken transactions that were actually only running object-level and not db level transactions [andreas]

* Fixed that validates_uniqueness_of used 'id' instead of defined primary key #406

* Fixed that the overwritten respond_to? method didn't take two parameters like the original #391

* Fixed quoting in validates_format_of that would allow some rules to pass regardless of input #390 [Dmitry V. Sabanin]
4938 4939 4940


*1.3.0* (December 23, 2004)
4941

4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954
* Added a require_association hook on const_missing that makes it possible to use any model class without requiring it first. This makes STI look like:

    before:
      require_association 'person'
      class Employee < Person
      end
    
    after:
      class Employee < Person
      end

  This also reduces the usefulness of Controller.model in Action Pack to currently only being for documentation purposes.      

4955 4956
* Added that Base.update_all and Base.delete_all return an integer of the number of affected rows #341

D
David Heinemeier Hansson 已提交
4957
* Added scope option to validation_uniqueness #349 [Kent Sibilev]
4958

4959 4960 4961
* Added respondence to *_before_type_cast for all attributes to return their string-state before they were type casted by the column type.
  This is helpful for getting "100,000" back on a integer-based validation where the value would normally be "100".

D
David Heinemeier Hansson 已提交
4962 4963 4964 4965 4966
* Added allow_nil options to validates_inclusion_of so that validation is only triggered if the attribute is not nil [what-a-day]

* Added work-around for PostgreSQL and the problem of getting fixtures to be created from id 1 on each test case.
  This only works for auto-incrementing primary keys called "id" for now #359 [Scott Baron]

4967
* Added Base#clear_association_cache to empty all the cached associations #347 [Tobias Lütke]
D
David Heinemeier Hansson 已提交
4968

4969
* Added more informative exceptions in establish_connection #356 [Jeremy Kemper]
4970

4971 4972 4973 4974 4975 4976 4977 4978 4979
* Added Base#update_attributes that'll accept a hash of attributes and save the record (returning true if it passed validation, false otherwise). 

    Before:
      person.attributes = @params["person"]
      person.save
    
    Now:
      person.update_attributes(@params["person"])

4980 4981
* Added Base.destroy and Base.delete to remove records without holding a reference to them first.

D
David Heinemeier Hansson 已提交
4982 4983
* Added that query benchmarking will only happen if its going to be logged anyway #344

4984
* Added higher_item and lower_item as public methods for acts_as_list #342 [Tobias Lütke]
D
David Heinemeier Hansson 已提交
4985

4986
* Fixed that options[:counter_sql] was overwritten with interpolated sql rather than original sql #355 [Jeremy Kemper]
D
David Heinemeier Hansson 已提交
4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003

* Fixed that overriding an attribute's accessor would be disregarded by add_on_empty and add_on_boundary_breaking because they simply used 
  the attributes[] hash instead of checking for @base.respond_to?(attr.to_s). [Marten]

* Fixed that Base.table_name would expect a parameter when used in has_and_belongs_to_many joins [Anna Lissa Cruz]

* Fixed that nested transactions now work by letting the outer most transaction have the responsibilty of starting and rolling back the transaction.
  If any of the inner transactions swallow the exception raised, though, the transaction will not be rolled back. So always let the transaction
  bubble up even when you've dealt with local issues. Closes #231 and #340.

* Fixed validates_{confirmation,acceptance}_of to only happen when the virtual attributes are not nil #348 [dpiddy@gmail.com]

* Changed the interface on AbstractAdapter to require that adapters return the number of affected rows on delete and update operations.

* Fixed the automated timestamping feature when running under Rails' development environment that resets the inheritable attributes on each request.


5004

D
David Heinemeier Hansson 已提交
5005
*1.2.0*
D
Initial  
David Heinemeier Hansson 已提交
5006

5007 5008 5009 5010 5011 5012 5013 5014
* Added Base.validates_inclusion_of that validates whether the value of the specified attribute is available in a particular enumerable
  object. [what-a-day]

    class Person < ActiveRecord::Base
      validates_inclusion_of :gender, :in=>%w( m f ), :message=>"woah! what are you then!??!!"
      validates_inclusion_of :age, :in=>0..99
    end

5015
* Added acts_as_list that can decorates an existing class with methods like move_higher/lower, move_to_top/bottom. [Tobias Lütke] Example:
5016 5017 5018 5019 5020 5021 5022

    class TodoItem < ActiveRecord::Base
      acts_as_list :scope => :todo_list_id
      belongs_to :todo_list
    end

* Added acts_as_tree that can decorates an existing class with a many to many relationship with itself. Perfect for categories in 
5023
  categories and the likes. [Tobias Lütke]
5024 5025

* Added that Active Records will automatically record creation and/or update timestamps of database objects if fields of the names 
5026
  created_at/created_on or updated_at/updated_on are present. [Tobias Lütke]
5027

5028
* Added Base.default_error_messages as a hash of all the error messages used in the validates_*_of so they can be changed in one place [Tobias Lütke]
5029

5030 5031
* Added automatic transaction block around AssociationCollection.<<, AssociationCollection.delete, and AssociationCollection.destroy_all

5032 5033
* Fixed that Base#find will return an array if given an array -- regardless of the number of elements #270 [Marten]

5034 5035
* Fixed that has_and_belongs_to_many would generate bad sql when naming conventions differed from using vanilla "id" everywhere [RedTerror]

5036 5037 5038 5039 5040 5041 5042 5043 5044 5045
* Added a better exception for when a type column is used in a table without the intention of triggering single-table inheritance. Example:

    ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'bad_class!'.
    This error is raised because the column 'type' is reserved for storing the class in case of inheritance. 
    Please rename this column if you didn't intend it to be used for storing the inheritance class or 
    overwrite Company.inheritance_column to use another column for that information.

* Added that single-table inheritance will only kick in if the inheritance_column (by default "type") is present. Otherwise, inheritance won't
  have any magic side effects.

5046 5047
* Added the possibility of marking fields as being in error without adding a message (using nil) to it that'll get displayed wth full_messages #208 [mjobin] 

5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059
* Fixed Base.errors to be indifferent as to whether strings or symbols are used. Examples:

    Before:
      errors.add(:name, "must be shorter") if name.size > 10
      errors.on(:name)  # => "must be shorter"
      errors.on("name") # => nil

    After:
      errors.add(:name, "must be shorter") if name.size > 10
      errors.on(:name)  # => "must be shorter"
      errors.on("name") # => "must be shorter"

5060
* Added Base.validates_format_of that Validates whether the value of the specified attribute is of the correct form by matching 
5061
  it against the regular expression provided. [Marcel Molina Jr.]
5062 5063 5064 5065 5066

    class Person < ActiveRecord::Base
      validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/, :on => :create
    end

5067
* Added Base.validates_length_of that delegates to add_on_boundary_breaking #312 [Tobias Lütke]. Example:
5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085

    Validates that the specified attribute matches the length restrictions supplied in either:
    
      - configuration[:minimum]
      - configuration[:maximum]
      - configuration[:is]
      - configuration[:within] (aka. configuration[:in])
    
    Only one option can be used at a time.
    
      class Person < ActiveRecord::Base
        validates_length_of :first_name, :maximum=>30
        validates_length_of :last_name, :maximum=>30, :message=>"less than %d if you don't mind"
        validates_length_of :user_name, :within => 6..20, :too_long => "pick a shorter name", :too_short => "pick a longer name"
        validates_length_of :fav_bra_size, :minimum=>1, :too_short=>"please enter at least %d character"
        validates_length_of :smurf_leader, :is=>4, :message=>"papa is spelled with %d characters... don't play me."
      end
    
5086 5087
* Added Base.validate_presence as an alternative to implementing validate and doing errors.add_on_empty yourself.

5088
* Added Base.validates_uniqueness_of that alidates whether the value of the specified attributes are unique across the system. 
5089 5090
  Useful for making sure that only one user can be named "davidhh".
  
5091 5092 5093
    class Person < ActiveRecord::Base
      validates_uniqueness_of :user_name
    end
5094 5095 5096 5097 5098
  
  When the record is created, a check is performed to make sure that no record exist in the database with the given value for the specified
  attribute (that maps to a column). When the record is updated, the same check is made but disregarding the record itself.


5099
* Added Base.validates_confirmation_of that encapsulates the pattern of wanting to validate a password or email address field with a confirmation. Example:
5100 5101 5102
 
     Model:
       class Person < ActiveRecord::Base
5103
         validates_confirmation_of :password
5104 5105 5106 5107 5108 5109 5110
       end
  
     View:
       <%= password_field "person", "password" %>
       <%= password_field "person", "password_confirmation" %>
  
   The person has to already have a password attribute (a column in the people table), but the password_confirmation is virtual.
5111
   It exists only as an in-memory variable for validating the password. This check is performed both on create and update.
5112

5113

5114
* Added Base.validates_acceptance_of that encapsulates the pattern of wanting to validate the acceptance of a terms of service check box (or similar agreement). Example:
5115
  
5116 5117 5118
   class Person < ActiveRecord::Base
     validates_acceptance_of :terms_of_service
   end
5119
  
5120
  The terms_of_service attribute is entirely virtual. No database column is needed. This check is performed both on create and update.
5121 5122 5123 5124

  NOTE: The agreement is considered valid if it's set to the string "1". This makes it easy to relate it to an HTML checkbox.

  
5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137
* Added validation macros to make the stackable just like the lifecycle callbacks. Examples:

    class Person < ActiveRecord::Base
      validate { |record| record.errors.add("name", "too short") unless name.size > 10 }
      validate { |record| record.errors.add("name", "too long")  unless name.size < 20 }
      validate_on_create :validate_password
      
      private
        def validate_password
          errors.add("password", "too short") unless password.size > 6
        end
    end

5138 5139 5140 5141 5142
* Added the option for sanitizing find_by_sql and the offset parts in regular finds [Sam Stephenson]. Examples:

    Project.find_all ["category = ?", category_name], "created ASC", ["? OFFSET ?", 15, 20]
    Post.find_by_sql ["SELECT * FROM posts WHERE author = ? AND created > ?", author_id, start_date]

5143 5144 5145 5146
* Fixed value quoting in all generated SQL statements, so that integers are not surrounded in quotes and that all sanitation are happening
  through the database's own quoting routine. This should hopefully make it lots easier for new adapters that doesn't accept '1' for integer
  columns.

5147 5148 5149
* Fixed has_and_belongs_to_many guessing of foreign key so that keys are generated correctly for models like SomeVerySpecialClient 
  [Florian Weber]

5150
* Added counter_sql option for has_many associations [Jeremy Kemper]. Documentation:
5151 5152 5153 5154

    <tt>:counter_sql</tt> - specify a complete SQL statement to fetch the size of the association. If +:finder_sql+ is
    specified but +:counter_sql+, +:counter_sql+ will be generated by replacing SELECT ... FROM with SELECT COUNT(*) FROM.

5155
* Fixed that methods wrapped in callbacks still return their original result #260 [Jeremy Kemper]
5156

5157 5158
* Fixed the Inflector to handle the movie/movies pair correctly #261 [Scott Baron]

5159 5160 5161 5162
* Added named bind-style variable interpolation #281 [Michael Koziarski]. Example:

    Person.find(["id = :id and first_name = :first_name", { :id => 5, :first_name = "bob' or 1=1" }])

5163 5164 5165 5166 5167 5168 5169 5170 5171 5172
* Added bind-style variable interpolation for the condition arrays that uses the adapter's quote method [Michael Koziarski]

  Before:
    find_first([ "user_name = '%s' AND password = '%s'", user_name, password ])]
    find_first([ "firm_id = %s", firm_id ])] # unsafe!

  After:
    find_first([ "user_name = ? AND password = ?", user_name, password ])]
    find_first([ "firm_id = ?", firm_id ])]

5173 5174
* Added CSV format for fixtures #272 [what-a-day]. (See the new and expanded documentation on fixtures for more information)

5175 5176
* Fixed fixtures using primary key fields called something else than "id" [dave]

5177 5178
* Added proper handling of time fields that are turned into Time objects with the dummy date of 2000/1/1 [HariSeldon]

5179 5180
* Added reverse order of deleting fixtures, so referential keys can be maintained #247 [Tim Bates]

5181
* Added relative path search for sqlite dbfiles in database.yml (if RAILS_ROOT is defined) #233 [Jeremy Kemper]
5182

5183 5184
* Added option to establish_connection where you'll be able to leave out the parameter to have it use the RAILS_ENV environment variable

D
Initial  
David Heinemeier Hansson 已提交
5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253
* Fixed problems with primary keys and postgresql sequences (#230) [Tim Bates]

* Added reloading for associations under cached environments like FastCGI and mod_ruby. This makes it possible to use those environments for development.
  This is turned on by default, but can be turned off with ActiveRecord::Base.reload_dependencies = false in production environments.

  NOTE: This will only have an effect if you let the associations manage the requiring of model classes. All libraries loaded through
  require will be "forever" cached. You can, however, use ActiveRecord::Base.load_or_require("library") to get this behavior outside of the
  auto-loading associations.

* Added ERB capabilities to the fixture files for dynamic fixture generation. You don't need to do anything, just include ERB blocks like:

    david:
      id: 1
      name: David

    jamis:
      id: 2
      name: Jamis

    <% for digit in 3..10 %>
    dev_<%= digit %>:
      id: <%= digit %>
      name: fixture_<%= digit %>
    <% end %>

* Changed the yaml fixture searcher to look in the root of the fixtures directory, so when you before could have something like:

    fixtures/developers/fixtures.yaml
    fixtures/accounts/fixtures.yaml
  
  ...you now need to do:
  
    fixtures/developers.yaml
    fixtures/accounts.yaml

* Changed the fixture format from:

    name: david
    data:
     id: 1
     name: David Heinemeier Hansson
     birthday: 1979-10-15
     profession: Systems development
    ---
    name: steve
    data:
     id: 2
     name: Steve Ross Kellock
     birthday: 1974-09-27
     profession: guy with keyboard

  ...to:

    david:
     id: 1
     name: David Heinemeier Hansson
     birthday: 1979-10-15
     profession: Systems development
    
    steve:
     id: 2
     name: Steve Ross Kellock
     birthday: 1974-09-27
     profession: guy with keyboard
    
  The change is NOT backwards compatible. Fixtures written in the old YAML style needs to be rewritten!

* All associations will now attempt to require the classes that they associate to. Relieving the need for most explicit 'require' statements.

5254

D
Initial  
David Heinemeier Hansson 已提交
5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279
*1.1.0* (34)

* Added automatic fixture setup and instance variable availability. Fixtures can also be automatically 
  instantiated in instance variables relating to their names using the following style:

    class FixturesTest < Test::Unit::TestCase
      fixtures :developers # you can add more with comma separation

      def test_developers
        assert_equal 3, @developers.size # the container for all the fixtures is automatically set
        assert_kind_of Developer, @david # works like @developers["david"].find
        assert_equal "David Heinemeier Hansson", @david.name
      end
    end

* Added HasAndBelongsToManyAssociation#push_with_attributes(object, join_attributes) that can create associations in the join table with additional
  attributes. This is really useful when you have information that's only relevant to the join itself, such as a "added_on" column for an association
  between post and category. The added attributes will automatically be injected into objects retrieved through the association similar to the piggy-back
  approach:
  
    post.categories.push_with_attributes(category, :added_on => Date.today)
    post.categories.first.added_on # => Date.today
    
  NOTE: The categories table doesn't have a added_on column, it's the categories_post join table that does!

5280
* Fixed that :exclusively_dependent and :dependent can't be activated at the same time on has_many associations [Jeremy Kemper]
D
Initial  
David Heinemeier Hansson 已提交
5281

5282
* Fixed that database passwords couldn't be all numeric [Jeremy Kemper]
D
Initial  
David Heinemeier Hansson 已提交
5283

5284
* Fixed that calling id would create the instance variable for new_records preventing them from being saved correctly [Jeremy Kemper]
D
Initial  
David Heinemeier Hansson 已提交
5285

5286
* Added sanitization feature to HasManyAssociation#find_all so it works just like Base.find_all [Sam Stephenson/Jeremy Kemper]
D
Initial  
David Heinemeier Hansson 已提交
5287

5288
* Added that you can pass overlapping ids to find without getting duplicated records back [Jeremy Kemper]
D
Initial  
David Heinemeier Hansson 已提交
5289

5290
* Added that Base.benchmark returns the result of the block [Jeremy Kemper]
D
Initial  
David Heinemeier Hansson 已提交
5291 5292 5293 5294 5295

* Fixed problem with unit tests on Windows with SQLite [paterno]

* Fixed that quotes would break regular non-yaml fixtures [Dmitry Sabanin/daft]

5296
* Fixed fixtures on windows with line endings cause problems under unix / mac [Tobias Lütke]
D
Initial  
David Heinemeier Hansson 已提交
5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373

* Added HasAndBelongsToManyAssociation#find(id) that'll search inside the collection and find the object or record with that id

* Added :conditions option to has_and_belongs_to_many that works just like the one on all the other associations

* Added AssociationCollection#clear to remove all associations from has_many and has_and_belongs_to_many associations without destroying the records [geech]

* Added type-checking and remove in 1-instead-of-N sql statements to AssociationCollection#delete [geech]

* Added a return of self to AssociationCollection#<< so appending can be chained, like project << Milestone.create << Milestone.create [geech]

* Added Base#hash and Base#eql? which means that all of the equality using features of array and other containers now works:

    [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]

* Added :uniq as an option to has_and_belongs_to_many which will automatically ensure that AssociateCollection#uniq is called
  before pulling records out of the association. This is especially useful for three-way (and above) has_and_belongs_to_many associations.

* Added AssociateCollection#uniq which is especially useful for has_and_belongs_to_many associations that can include duplicates,
  which is common on associations that also use metadata. Usage: post.categories.uniq

* Fixed respond_to? to use a subclass specific hash instead of an Active Record-wide one

* Fixed has_and_belongs_to_many to treat associations between classes in modules properly [Florian Weber]

* Added a NoMethod exception to be raised when query and writer methods are called for attributes that doesn't exist [geech]

* Added a more robust version of Fixtures that throws meaningful errors when on formatting issues [geech]

* Added Base#transaction as a compliment to Base.transaction for prettier use in instance methods [geech]

* Improved the speed of respond_to? by placing the dynamic methods lookup table in a hash [geech]

* Added that any additional fields added to the join table in a has_and_belongs_to_many association 
  will be placed as attributes when pulling records out through has_and_belongs_to_many associations. 
  This is helpful when have information about the association itself that you want available on retrival.

* Added better loading exception catching and RubyGems retries to the database adapters [alexeyv]

* Fixed bug with per-model transactions [daniel]

* Fixed Base#transaction so that it returns the result of the last expression in the transaction block [alexeyv]

* Added Fixture#find to find the record corresponding to the fixture id. The record 
  class name is guessed by using Inflector#classify (also new) on the fixture directory name.
  
    Before: Document.find(@documents["first"]["id"])
    After : @documents["first"].find

* Fixed that the table name part of column names ("TABLE.COLUMN") wasn't removed properly [Andreas Schwarz]

* Fixed a bug with Base#size when a finder_sql was used that didn't capitalize SELECT and FROM [geech]

* Fixed quoting problems on SQLite by adding quote_string to the AbstractAdapter that can be overwritten by the concrete
  adapters for a call to the dbm. [Andreas Schwarz]
  
* Removed RubyGems backup strategy for requiring SQLite-adapter -- if people want to use gems, they're already doing it with AR.


*1.0.0 (35)*

* Added OO-style associations methods [Florian Weber]. Examples:

    Project#milestones_count       => Project#milestones.size
    Project#build_to_milestones    => Project#milestones.build
    Project#create_for_milestones  => Project#milestones.create
    Project#find_in_milestones     => Project#milestones.find
    Project#find_all_in_milestones => Project#milestones.find_all

* Added serialize as a new class method to control when text attributes should be YAMLized or not. This means that automated
  serialization of hashes, arrays, and so on WILL NO LONGER HAPPEN (#10). You need to do something like this:
  
    class User < ActiveRecord::Base
      serialize :settings
    end
  
  This will assume that settings is a text column and will now YAMLize any object put in that attribute. You can also specify
P
Pratik Naik 已提交
5374
  an optional :class_name option that'll raise an exception if a serialized object is retrieved as a descendant of a class not in
D
Initial  
David Heinemeier Hansson 已提交
5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416
  the hierarchy. Example:
  
    class User < ActiveRecord::Base
      serialize :settings, :class_name => "Hash"
    end
  
    user = User.create("settings" => %w( one two three ))
    User.find(user.id).settings # => raises SerializationTypeMismatch

* Added the option to connect to a different database for one model at a time. Just call establish_connection on the class
  you want to have connected to another database than Base. This will automatically also connect decendents of that class
  to the different database [Renald Buter].

* Added transactional protection for Base#save. Validations can now check for values knowing that it happens in a transaction and callbacks
  can raise exceptions knowing that the save will be rolled back. [Suggested by Alexey Verkhovsky]

* Added column name quoting so reserved words, such as "references", can be used as column names [Ryan Platte]

* Added the possibility to chain the return of what happened inside a logged block [geech]:

    This now works: 
      log { ... }.map { ... }

    Instead of doing:
      result = []
      log { result = ... }
      result.map { ... }

* Added "socket" option for the MySQL adapter, so you can change it to something else than "/tmp/mysql.sock" [Anna Lissa Cruz]

* Added respond_to? answers for all the attribute methods. So if Person has a name attribute retrieved from the table schema, 
  person.respond_to? "name" will return true.

* Added Base.benchmark which can be used to aggregate logging and benchmark, so you can measure and represent multiple statements in a single block.
  Usage (hides all the SQL calls for the individual actions and calculates total runtime for them all):

    Project.benchmark("Creating project") do
      project = Project.create("name" => "stuff")
      project.create_manager("name" => "David")
      project.milestones << Milestone.find_all
    end

5417
* Added logging of invalid SQL statements [Daniel Von Fange]
D
Initial  
David Heinemeier Hansson 已提交
5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448

* Added alias Errors#[] for Errors#on, so you can now say person.errors["name"] to retrieve the errors for name [Andreas Schwarz]

* Added RubyGems require attempt if sqlite-ruby is not available through regular methods.

* Added compatibility with 2.x series of sqlite-ruby drivers. [Jamis Buck]

* Added type safety for association assignments, so a ActiveRecord::AssociationTypeMismatch will be raised if you attempt to
  assign an object that's not of the associated class. This cures the problem with nil giving id = 4 and fixnums giving id = 1 on 
  mistaken association assignments. [Reported by Andreas Schwarz]

* Added the option to keep many fixtures in one single YAML document [what-a-day]

* Added the class method "inheritance_column" that can be overwritten to return the name of an alternative column than "type" for storing
  the type for inheritance hierarchies. [Dave Steinberg]

* Added [] and []= as an alternative way to access attributes when the regular methods have been overwritten [Dave Steinberg]

* Added the option to observer more than one class at the time by specifying observed_class as an array

* Added auto-id propagation support for tables with arbitrary primary keys that have autogenerated sequences associated with them 
  on PostgreSQL. [Dave Steinberg]

* Changed that integer and floats set to "" through attributes= remain as NULL. This was especially a problem for scaffolding and postgresql. (#49)

* Changed the MySQL Adapter to rely on MySQL for its defaults for socket, host, and port [Andreas Schwarz]

* Changed ActionControllerError to decent from StandardError instead of Exception. It can now be caught by a generic rescue.

* Changed class inheritable attributes to not use eval [Caio Chassot]

5449
* Changed Errors#add to now use "invalid" as the default message instead of true, which means full_messages work with those [Marcel Molina Jr.]
D
Initial  
David Heinemeier Hansson 已提交
5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525

* Fixed spelling on Base#add_on_boundry_breaking to Base#add_on_boundary_breaking (old naming still works) [Marcel Molina Jr.]

* Fixed that entries in the has_and_belongs_to_many join table didn't get removed when an associated object was destroyed.

* Fixed unnecessary calls to SET AUTOCOMMIT=0/1 for MySQL adapter [Andreas Schwarz]

* Fixed PostgreSQL defaults are now handled gracefully [Dave Steinberg]

* Fixed increment/decrement_counter are now atomic updates [Andreas Schwarz]

* Fixed the problems the Inflector had turning Attachment into attuchments and Cases into Casis [radsaq/Florian Gross]

* Fixed that cloned records would point attribute references on the parent object [Andreas Schwarz]

* Fixed SQL for type call on inheritance hierarchies [Caio Chassot]

* Fixed bug with typed inheritance [Florian Weber]

* Fixed a bug where has_many collection_count wouldn't use the conditions specified for that association


*0.9.5*

* Expanded the table_name guessing rules immensely [Florian Green]. Documentation:

    Guesses the table name (in forced lower-case) based on the name of the class in the inheritance hierarchy descending
    directly from ActiveRecord. So if the hierarchy looks like: Reply < Message < ActiveRecord, then Message is used
    to guess the table name from even when called on Reply. The guessing rules are as follows:
    * Class name ends in "x", "ch" or "ss": "es" is appended, so a Search class becomes a searches table.
    * Class name ends in "y" preceded by a consonant or "qu": The "y" is replaced with "ies", 
      so a Category class becomes a categories table. 
    * Class name ends in "fe": The "fe" is replaced with "ves", so a Wife class becomes a wives table.
    * Class name ends in "lf" or "rf": The "f" is replaced with "ves", so a Half class becomes a halves table.
    * Class name ends in "person": The "person" is replaced with "people", so a Salesperson class becomes a salespeople table.
    * Class name ends in "man": The "man" is replaced with "men", so a Spokesman class becomes a spokesmen table.
    * Class name ends in "sis": The "i" is replaced with an "e", so a Basis class becomes a bases table.
    * Class name ends in "tum" or "ium": The "um" is replaced with an "a", so a Datum class becomes a data table.
    * Class name ends in "child": The "child" is replaced with "children", so a NodeChild class becomes a node_children table.
    * Class name ends in an "s": No additional characters are added or removed.
    * Class name doesn't end in "s": An "s" is appended, so a Comment class becomes a comments table.
    * Class name with word compositions: Compositions are underscored, so CreditCard class becomes a credit_cards table.
    Additionally, the class-level table_name_prefix is prepended to the table_name and the table_name_suffix is appended.
    So if you have "myapp_" as a prefix, the table name guess for an Account class becomes "myapp_accounts".
    
    You can also overwrite this class method to allow for unguessable links, such as a Mouse class with a link to a
    "mice" table. Example:
    
      class Mouse < ActiveRecord::Base
         def self.table_name() "mice" end
      end
  
  This conversion is now done through an external class called Inflector residing in lib/active_record/support/inflector.rb.

* Added find_all_in_collection to has_many defined collections. Works like this:

    class Firm < ActiveRecord::Base
      has_many :clients
    end
    
    firm.id # => 1
    firm.find_all_in_clients "revenue > 1000" # SELECT * FROM clients WHERE firm_id = 1 AND revenue > 1000

  [Requested by Dave Thomas]

* Fixed finders for inheritance hierarchies deeper than one level [Florian Weber]

* Added add_on_boundry_breaking to errors to accompany add_on_empty as a default validation method. It's used like this:

    class Person < ActiveRecord::Base
      protected
        def validation
          errors.add_on_boundry_breaking "password", 3..20
        end
    end
    
D
David Heinemeier Hansson 已提交
5526
  This will add an error to the tune of "is too short (minimum is 3 characters)" or "is too long (minimum is 20 characters)" if
D
Initial  
David Heinemeier Hansson 已提交
5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579
  the password is outside the boundry. The messages can be changed by passing a third and forth parameter as message strings.

* Implemented a clone method that works properly with AR. It returns a clone of the record that 
  hasn't been assigned an id yet and is treated as a new record.

* Allow for domain sockets in PostgreSQL by not assuming localhost when no host is specified [Scott Barron]

* Fixed that bignums are saved properly instead of attempted to be YAMLized [Andreas Schwartz]

* Fixed a bug in the GEM where the rdoc options weren't being passed according to spec [Chad Fowler]

* Fixed a bug with the exclusively_dependent option for has_many


*0.9.4*

* Correctly guesses the primary key when the class is inside a module [Dave Steinberg].

* Added [] and []= as alternatives to read_attribute and write_attribute [Dave Steinberg]

* has_and_belongs_to_many now accepts an :order key to determine in which order the collection is returned [radsaq].

* The ids passed to find and find_on_conditions are now automatically sanitized.

* Added escaping of plings in YAML content.

* Multi-parameter assigns where all the parameters are empty will now be set to nil instead of a new instance of their class.

* Proper type within an inheritance hierarchy is now ensured already at object initialization (instead of first at create)


*0.9.3*

* Fixed bug with using a different primary key name together with has_and_belongs_to_many [Investigation by Scott] 

* Added :exclusively_dependent option to the has_many association macro. The doc reads:

    If set to true all the associated object are deleted in one SQL statement without having their
    before_destroy callback run. This should only be used on associations that depend solely on 
    this class and don't need to do any clean-up in before_destroy. The upside is that it's much
    faster, especially if there's a counter_cache involved.

* Added :port key to connection options, so the PostgreSQL and MySQL adapters can connect to a database server
  running on another port than the default.

* Converted the new natural singleton methods that prevented AR objects from being saved by PStore
  (and hence be placed in a Rails session) to a module. [Florian Weber]

* Fixed the use of floats (was broken since 0.9.0+)

* Fixed PostgreSQL adapter so default values are displayed properly when used in conjunction with 
  Action Pack scaffolding.

5580
* Fixed booleans support for PostgreSQL (use real true/false on boolean fields instead of 0/1 on tinyints) [radsaq]
D
Initial  
David Heinemeier Hansson 已提交
5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869


*0.9.2*

* Added static method for instantly updating a record

* Treat decimal and numeric as Ruby floats [Andreas Schwartz]

* Treat chars as Ruby strings (fixes problem for Action Pack form helpers too)

* Removed debugging output accidently left in (which would screw web applications)


*0.9.1*

* Added MIT license

* Added natural object-style assignment for has_and_belongs_to_many associations. Consider the following model:

    class Event < ActiveRecord::Base
      has_one_and_belongs_to_many :sponsors
    end
    
    class Sponsor < ActiveRecord::Base
      has_one_and_belongs_to_many :sponsors
    end

  Earlier, you'd have to use synthetic methods for creating associations between two objects of the above class:
  
    roskilde_festival.add_to_sponsors(carlsberg)
    roskilde_festival.remove_from_sponsors(carlsberg)

    nike.add_to_events(world_cup)
    nike.remove_from_events(world_cup)
    
  Now you can use regular array-styled methods:
  
    roskilde_festival.sponsors << carlsberg
    roskilde_festival.sponsors.delete(carlsberg)

    nike.events << world_cup
    nike.events.delete(world_cup)

* Added delete method for has_many associations. Using this will nullify an association between the has_many and the belonging
  object by setting the foreign key to null. Consider this model:
  
    class Post < ActiveRecord::Base
      has_many :comments
    end

    class Comment < ActiveRecord::Base
      belongs_to :post
    end

  You could do something like:

    funny_comment.has_post? # => true
    announcement.comments.delete(funny_comment)
    funny_comment.has_post? # => false


*0.9.0*

* Active Record is now thread safe! (So you can use it with Cerise and WEBrick applications)
  [Implementation idea by Michael Neumann, debugging assistance by Jamis Buck]

* Improved performance by roughly 400% on a basic test case of pulling 100 records and querying one attribute. 
  This brings the tax for using Active Record instead of "riding on the metal" (using MySQL-ruby C-driver directly) down to ~50%.
  Done by doing lazy type conversions and caching column information on the class-level.

* Added callback objects and procs as options for implementing the target for callback macros.

* Added "counter_cache" option to belongs_to that automates the usage of increment_counter and decrement_counter. Consider:

    class Post < ActiveRecord::Base
      has_many :comments
    end

    class Comment < ActiveRecord::Base
      belongs_to :post
    end

  Iterating over 100 posts like this:
  
    <% for post in @posts %>
      <%= post.title %> has <%= post.comments_count %> comments
    <% end %>
    
  Will generate 100 SQL count queries -- one for each call to post.comments_count. If you instead add a "comments_count" int column
  to the posts table and rewrite the comments association macro with:

    class Comment < ActiveRecord::Base
      belongs_to :post, :counter_cache => true
    end
  
  Those 100 SQL count queries will be reduced to zero. Beware that counter caching is only appropriate for objects that begin life
  with the object it's specified to belong with and is destroyed like that as well. Typically objects where you would also specify
  :dependent => true. If your objects switch from one belonging to another (like a post that can be move from one category to another),
  you'll have to manage the counter yourself. 

* Added natural object-style assignment for has_one and belongs_to associations. Consider the following model:

    class Project < ActiveRecord::Base
      has_one :manager
    end
    
    class Manager < ActiveRecord::Base
      belongs_to :project
    end
  
  Earlier, assignments would work like following regardless of which way the assignment told the best story:
  
    active_record.manager_id = david.id
  
  Now you can do it either from the belonging side:

    david.project = active_record
  
  ...or from the having side:
  
    active_record.manager = david
  
  If the assignment happens from the having side, the assigned object is automatically saved. So in the example above, the 
  project_id attribute on david would be set to the id of active_record, then david would be saved.

* Added natural object-style assignment for has_many associations [Florian Weber]. Consider the following model:

    class Project < ActiveRecord::Base
      has_many :milestones
    end
    
    class Milestone < ActiveRecord::Base
      belongs_to :project
    end
  
  Earlier, assignments would work like following regardless of which way the assignment told the best story:
  
    deadline.project_id = active_record.id
  
  Now you can do it either from the belonging side:

    deadline.project = active_record
  
  ...or from the having side:
  
    active_record.milestones << deadline
  
  The milestone is automatically saved with the new foreign key.

* API CHANGE: Attributes for text (or blob or similar) columns will now have unknown classes stored using YAML instead of using
  to_s. (Known classes that won't be yamelized are: String, NilClass, TrueClass, FalseClass, Fixnum, Date, and Time).
  Likewise, data pulled out of text-based attributes will be attempted converged using Yaml if they have the "--- " header.
  This was primarily done to be enable the storage of hashes and arrays without wrapping them in aggregations, so now you can do:
  
    user = User.find(1)
    user.preferences = { "background" => "black", "display" => large }
    user.save
    
    User.find(1).preferences # => { "background" => "black", "display" => large }
  
  Please note that this method should only be used when you don't care about representing the object in proper columns in
  the database. A money object consisting of an amount and a currency is still a much better fit for a value object done through
  aggregations than this new option.

* POSSIBLE CODE BREAKAGE: As a consequence of the lazy type conversions, it's a bad idea to reference the @attributes hash
  directly (it always was, but now it's paramount that you don't). If you do, you won't get the type conversion. So to implement
  new accessors for existing attributes, use read_attribute(attr_name) and write_attribute(attr_name, value) instead. Like this:
  
    class Song < ActiveRecord::Base
      # Uses an integer of seconds to hold the length of the song
      
      def length=(minutes)
        write_attribute("length", minutes * 60)
      end
      
      def length
        read_attribute("length") / 60
      end
    end

  The clever kid will notice that this opens a door to sidestep the automated type conversion by using @attributes directly.
  This is not recommended as read/write_attribute may be granted additional responsibilities in the future, but if you think
  you know what you're doing and aren't afraid of future consequences, this is an option.

* Applied a few minor bug fixes reported by Daniel Von Fange.


*0.8.4*

_Reflection_

* Added ActiveRecord::Reflection with a bunch of methods and classes for reflecting in aggregations and associations.

* Added Base.columns and Base.content_columns which returns arrays of column description (type, default, etc) objects.

* Added Base#attribute_names which returns an array of names for the attributes available on the object.

* Added Base#column_for_attribute(name) which returns the column description object for the named attribute.


_Misc_

* Added multi-parameter assignment:

    # Instantiate objects for all attribute classes that needs more than one constructor parameter. This is done
    # by calling new on the column type or aggregation type (through composed_of) object with these parameters.
    # So having the pairs written_on(1) = "2004", written_on(2) = "6", written_on(3) = "24", will instantiate
    # written_on (a date type) with Date.new("2004", "6", "24"). You can also specify a typecast character in the
    # parenteses to have the parameters typecasted before they're used in the constructor. Use i for Fixnum, f for Float,
    # s for String, and a for Array.
  
  This is incredibly useful for assigning dates from HTML drop-downs of month, year, and day.

* Fixed bug with custom primary key column name and Base.find on multiple parameters.

* Fixed bug with dependent option on has_one associations if there was no associated object.


*0.8.3*

_Transactions_

* Added transactional protection for destroy (important for the new :dependent option) [Suggested by Carl Youngblood]

* Fixed so transactions are ignored on MyISAM tables for MySQL (use InnoDB to get transactions)

* Changed transactions so only exceptions will cause a rollback, not returned false.


_Mapping_

* Added support for non-integer primary keys [Aredridel/earlier work by Michael Neumann]
  
    User.find "jdoe"
    Product.find "PDKEY-INT-12"

* Added option to specify naming method for primary key column. ActiveRecord::Base.primary_key_prefix_type can either
  be set to nil, :table_name, or :table_name_with_underscore. :table_name will assume that Product class has a primary key
  of "productid" and :table_name_with_underscore will assume "product_id". The default nil will just give "id".
    
* Added an overwriteable primary_key method that'll instruct AR to the name of the 
  id column [Aredridele/earlier work by Guan Yang]
    
    class Project < ActiveRecord::Base
      def self.primary_key() "project_id" end
    end

* Fixed that Active Records can safely associate inside and out of modules.

    class MyApplication::Account < ActiveRecord::Base
      has_many :clients # will look for MyApplication::Client
      has_many :interests, :class_name => "Business::Interest" # will look for Business::Interest
    end

* Fixed that Active Records can safely live inside modules [Aredridel]

    class MyApplication::Account < ActiveRecord::Base
    end


_Misc_

* Added freeze call to value object assignments to ensure they remain immutable [Spotted by Gavin Sinclair]
 
* Changed interface for specifying observed class in observers. Was OBSERVED_CLASS constant, now is 
  observed_class() class method. This is more consistant with things like self.table_name(). Works like this:

    class AuditObserver < ActiveRecord::Observer
      def self.observed_class() Account end
      def after_update(account)
        AuditTrail.new(account, "UPDATED")
      end
    end

  [Suggested by Gavin Sinclair]

* Create new Active Record objects by setting the attributes through a block. Like this:

    person = Person.new do |p|
      p.name = 'Freddy'
      p.age  = 19
    end

  [Suggested by Gavin Sinclair]


*0.8.2*

* Added inheritable callback queues that can ensure that certain callback methods or inline fragments are
P
Pratik Naik 已提交
5870
  run throughout the entire inheritance hierarchy. Regardless of whether a descendant overwrites the callback
D
Initial  
David Heinemeier Hansson 已提交
5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900
  method:
  
    class Topic < ActiveRecord::Base
      before_destroy :destroy_author, 'puts "I'm an inline fragment"'
    end
  
  Learn more in link:classes/ActiveRecord/Callbacks.html

* Added :dependent option to has_many and has_one, which will automatically destroy associated objects when 
  the holder is destroyed:
  
    class Album < ActiveRecord::Base
      has_many :tracks, :dependent => true
    end
    
  All the associated tracks are destroyed when the album is.

* Added Base.create as a factory that'll create, save, and return a new object in one step.

* Automatically convert strings in config hashes to symbols for the _connection methods. This allows you
  to pass the argument hashes directly from yaml. (Luke)

* Fixed the install.rb to include simple.rb [Spotted by Kevin Bullock]

* Modified block syntax to better follow our code standards outlined in 
  http://www.rubyonrails.org/CodingStandards


*0.8.1*

5901
* Added object-level transactions [Austin Ziegler]
D
Initial  
David Heinemeier Hansson 已提交
5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935

* Changed adapter-specific connection methods to use centralized ActiveRecord::Base.establish_connection,
  which is parametized through a config hash with symbol keys instead of a regular parameter list.
  This will allow for database connections to be opened in a more generic fashion. (Luke)
  
  NOTE: This requires all *_connections to be updated! Read more in:
  http://ar.rubyonrails.org/classes/ActiveRecord/Base.html#M000081

* Fixed SQLite adapter so objects fetched from has_and_belongs_to_many have proper attributes
  (t.name is now name). [Spotted by Garrett Rooney]

* Fixed SQLite adapter so dates are returned as Date objects, not Time objects [Spotted by Gavin Sinclair]

* Fixed requirement of date class, so date conversions are succesful regardless of whether you 
  manually require date or not.


*0.8.0*

* Added transactions

* Changed Base.find to also accept either a list (1, 5, 6) or an array of ids ([5, 7]) 
  as parameter and then return an array of objects instead of just an object

* Fixed method has_collection? for has_and_belongs_to_many macro to behave as a 
  collection, not an association

* Fixed SQLite adapter so empty or nil values in columns of datetime, date, or time type
  aren't treated as current time [Spotted by Gavin Sinclair]


*0.7.6*

* Fixed the install.rb to create the lib/active_record/support directory [Spotted by Gavin Sinclair]
5936
* Fixed that has_association? would always return true [Daniel Von Fange]