Skip to content
This repository
Newer
Older
100644 6652 lines (3866 sloc) 338.185 kb
75d039f1 » tenderlove
2012-06-11 adding version number to changelogs
1 ## Rails 3.1.6 (unreleased)
2
3 * No changes.
4
a7ed1981 » tenderlove
2012-05-31 updating the CHANGELOG
5 ## Rails 3.1.5 (May 31, 2012) ##
6
7 * Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931.
8
9 * only log an error if there is a logger. fixes #5226
10
11 * fix activerecord query_method regression with offset into Fixnum
12
13 * predicate builder should not recurse for determining where columns.
14 Thanks to Ben Murphy for reporting this! CVE-2012-2661
15
5f27545e » pimeys
2011-11-30 If the table behind has no primary key, do not ask again and just ret…
16 ## Rails 3.1.4 (unreleased) ##
17
df932c4a » jonleighton
2011-12-15 Fix #3987.
18 * Fix a custom primary key regression *GH 3987*
19
20 *Jon Leighton*
21
b6ae05e6 » jonleighton
2011-12-14 Fix #3672 again (dependent: delete_all perf)
22 * Perf fix (second try): don't load records for `has many :dependent =>
23 :delete_all` *GH 3672*
24
25 *Jon Leighton*
26
63293d1b » jonleighton
2011-12-08 Fix #3890. (Calling proxy_association in scope chain.)
27 * Fix accessing `proxy_association` method from an association extension
28 where the calls are chained. *GH #3890*
29
30 (E.g. `post.comments.where(bla).my_proxy_method`)
31
32 *Jon Leighton*
33
8d55a6d4 » kennyj
2011-11-22 Use show create table.
34 * Perf fix: MySQL primary key lookup was still slow for very large
35 tables. *GH 3678*
36
37 *Kenny J*
38
5f27545e » pimeys
2011-11-30 If the table behind has no primary key, do not ask again and just ret…
39 * Perf fix: If a table has no primary key, don't repeatedly ask the database for it.
40
41 *Julius de Bruijn*
42
c5197d47 » jonleighton
2011-11-19 Verify that #3690 has been closed by previous changes to the mysql
43 ## Rails 3.1.3 (unreleased) ##
44
cb0c3e45 » jonleighton
2011-11-19 Perf fix
45 * Perf fix: If we're deleting all records in an association, don't add a IN(..) clause
46 to the query. *GH 3672*
47
48 *Jon Leighton*
49
c5197d47 » jonleighton
2011-11-19 Verify that #3690 has been closed by previous changes to the mysql
50 * Fix bug with referencing other mysql databases in set_table_name. *GH 3690*
51
da327fc5 » jonleighton
2011-11-19 Add missing CHANGELOG entry for #3678. Closes #3678.
52 * Fix performance bug with mysql databases on a server with lots of other databses. *GH 3678*
53
54 *Christos Zisopoulos and Kenny J*
55
43486e0c » jonleighton
2011-11-04 Convert CHANGELOGs to Markdown format.
56 ## Rails 3.1.2 (unreleased) ##
57
b02daec7 » Juanmcuello
2011-10-05 Backport #3232 to 3-1-stable.
58 * Fix problem with prepared statements and PostgreSQL when multiple schemas are used.
59 *GH #3232*
60
61 *Juan M. Cuello*
62
e6d8ed57 » jonleighton
2011-11-14 Add missing CHANGELOG entries
63 * Fix bug with PostgreSQLAdapter#indexes. When the search path has multiple schemas, spaces
64 were not being stripped from the schema names after the first.
65
66 *Sean Kirby*
67
68 * Preserve SELECT columns on the COUNT for finder_sql when possible. *GH 3503*
69
70 *Justin Mazzi*
71
72 * Reset prepared statement cache when schema changes impact statement results. *GH 3335*
73
74 *Aaron Patterson*
75
76 * Postgres: Do not attempt to deallocate a statement if the connection is no longer active.
77
78 *Ian Leitch*
79
80 * Prevent QueryCache leaking database connections. *GH 3243*
81
82 *Mark J. Titorenko*
83
43486e0c » jonleighton
2011-11-04 Convert CHANGELOGs to Markdown format.
84 * Fix bug where building the conditions of a nested through association could potentially
85 modify the conditions of the through and/or source association. If you have experienced
86 bugs with conditions appearing in the wrong queries when using nested through associations,
87 this probably solves your problems. *GH #3271*
88
89 *Jon Leighton*
90
91 * If a record is removed from a has_many :through, all of the join records relating to that
92 record should also be removed from the through association's target.
93
94 *Jon Leighton*
95
96 * Fix adding multiple instances of the same record to a has_many :through. *GH #3425*
97
98 *Jon Leighton*
99
100 * Fix creating records in a through association with a polymorphic source type. *GH #3247*
101
102 *Jon Leighton*
103
fb734233 » kennyj
2011-11-06 Barckport to 3-1-stable: fixed an issue id false option is ignored on…
104 * MySQL: use the information_schema than the describe command when we look for a primary key. *GH #3440*
105 *Kenny J*
106
43486e0c » jonleighton
2011-11-04 Convert CHANGELOGs to Markdown format.
107 ## Rails 3.1.1 (October 7, 2011) ##
108
109 * Raise an exception if the primary key of a model in an association is needed
110 but unknown. Fixes #3207.
111
112 *Jon Leighton*
113
114 * Add deprecation for the preload_associations method. Fixes #3022.
115
116 *Jon Leighton*
117
118 * Don't require a DB connection when loading a model that uses set_primary_key. GH #2807.
119
120 *Jon Leighton*
121
122 * Fix using select() with a habtm association, e.g. Person.friends.select(:name). GH #3030 and
123 \#2923.
124
125 *Hendy Tanata*
126
127 * Fix belongs_to polymorphic with custom primary key on target. GH #3104.
128
129 *Jon Leighton*
130
131 * CollectionProxy#replace should change the DB records rather than just mutating the array.
132 Fixes #3020.
133
134 *Jon Leighton*
135
136 * LRU cache in mysql and sqlite are now per-process caches.
137
138 * lib/active_record/connection_adapters/mysql_adapter.rb: LRU cache
139 keys are per process id.
140 * lib/active_record/connection_adapters/sqlite_adapter.rb: ditto
141
142 *Aaron Patterson*
143
144 * Database adapters use a statement pool for limiting the number of open
145 prepared statments on the database. The limit defaults to 1000, but can
146 be adjusted in your database config by changing 'statement_limit'.
147
148 * Fix clash between using 'preload', 'joins' or 'eager_load' in a default scope and including the
149 default scoped model in a nested through association. (GH #2834.) *Jon Leighton*
150
151 * Ensure we are not comparing a string with a symbol in HasManyAssociation#inverse_updates_counter_cache?.
152 Fixes GH #2755, where a counter cache could be decremented twice as far as it was supposed to be.
153
154 *Jon Leighton*
155
156 * Don't send any queries to the database when the foreign key of a belongs_to is nil. Fixes
157 GH #2828. *Georg Friedrich*
158
159 * Fixed find_in_batches method to not include order from default_scope. See GH #2832 *Arun Agrawal*
160
161 * Don't compute table name for abstract classes. Fixes problem with setting the primary key
162 in an abstract class. See GH #2791. *Akira Matsuda*
163
164 * Psych errors with poor yaml formatting are proxied. Fixes GH #2645 and
165 GH #2731
166
167 * Use the LIMIT word with the methods #last and #first. Fixes GH #2783 *Damien Mathieu*
168
169 ## Rails 3.1.0 (August 30, 2011) ##
170
171 * Add a proxy_association method to association proxies, which can be called by association
172 extensions to access information about the association. This replaces proxy_owner etc with
173 proxy_association.owner.
174
175 *Jon Leighton*
176
177 * Active Record's dynamic finder will now show a deprecation warning if you passing in less number of arguments than what you call in method signature. This behavior will raise ArgumentError in the next version of Rails *Prem Sichanugrist*
178
179 * Deprecated the AssociationCollection constant. CollectionProxy is now the appropriate constant
180 to use, though be warned that this is not really a public API.
181
182 This should solve upgrade problems with the will_paginate plugin (and perhaps others). Thanks
183 Paul Battley for reporting.
184
185 *Jon Leighton*
186
187 * ActiveRecord::MacroReflection::AssociationReflection#build_record has a new method signature.
188
189 Before: def build_association(*options)
190 After: def build_association(*options, &block)
191
192 Users who are redefining this method to extend functionality should ensure that the block is
193 passed through to ActiveRecord::Base#new.
194
195 This change is necessary to fix https://github.com/rails/rails/issues/1842.
196
197 A deprecation warning and workaround has been added to 3.1, but authors will need to update
198 their code for it to work correctly in 3.2.
199
200 *Jon Leighton*
201
202 * AR#pluralize_table_names can be used to singularize/pluralize table name of an individual model:
203
204 class User < ActiveRecord::Base
205 self.pluralize_table_names = false
206 end
207
208 Previously this could only be set globally for all models through ActiveRecord::Base.pluralize_table_names. *Guillermo Iguaran*
209
210 * Add block setting of attributes to singular associations:
211
212 class User < ActiveRecord::Base
213 has_one :account
214 end
215
216 user.build_account{ |a| a.credit_limit => 100.0 }
217
218 The block is called after the instance has been initialized. *Andrew White*
219
220 * Add ActiveRecord::Base.attribute_names to return a list of attribute names. This will return an empty array if the model is abstract or table does not exists. *Prem Sichanugrist*
221
222 * CSV Fixtures are deprecated and support will be removed in Rails 3.2.0
223
224 * AR#new, AR#create, AR#create!, AR#update_attributes and AR#update_attributes! all accept a second hash as option that allows you
225 to specify which role to consider when assigning attributes. This is built on top of ActiveModel's
226 new mass assignment capabilities:
227
228 class Post < ActiveRecord::Base
229 attr_accessible :title
230 attr_accessible :title, :published_at, :as => :admin
231 end
232
233 Post.new(params[:post], :as => :admin)
234
235 assign_attributes() with similar API was also added and attributes=(params, guard) was deprecated.
236
237 Please note that this changes the method signatures for AR#new, AR#create, AR#create!, AR#update_attributes and AR#update_attributes!. If you have overwritten these methods you should update them accordingly.
238
239 *Josh Kalderimis*
240
241 * default_scope can take a block, lambda, or any other object which responds to `call` for lazy
242 evaluation:
243
244 default_scope { ... }
245 default_scope lambda { ... }
246 default_scope method(:foo)
247
248 This feature was originally implemented by Tim Morgan, but was then removed in favour of
249 defining a 'default_scope' class method, but has now been added back in by Jon Leighton.
250 The relevant lighthouse ticket is #1812.
251
252 * Default scopes are now evaluated at the latest possible moment, to avoid problems where
253 scopes would be created which would implicitly contain the default scope, which would then
254 be impossible to get rid of via Model.unscoped.
255
256 Note that this means that if you are inspecting the internal structure of an
257 ActiveRecord::Relation, it will *not* contain the default scope, though the resulting
258 query will do. You can get a relation containing the default scope by calling
259 ActiveRecord#with_default_scope, though this is not part of the public API.
260
261 *Jon Leighton*
262
263 * If you wish to merge default scopes in special ways, it is recommended to define your default
264 scope as a class method and use the standard techniques for sharing code (inheritance, mixins,
265 etc.):
266
267 class Post < ActiveRecord::Base
268 def self.default_scope
269 where(:published => true).where(:hidden => false)
270 end
271 end
272
273 *Jon Leighton*
274
275 * PostgreSQL adapter only supports PostgreSQL version 8.2 and higher.
276
277 * ConnectionManagement middleware is changed to clean up the connection pool
278 after the rack body has been flushed.
279
280 * Added an update_column method on ActiveRecord. This new method updates a given attribute on an object, skipping validations and callbacks.
281 It is recommended to use #update_attribute unless you are sure you do not want to execute any callback, including the modification of
282 the updated_at column. It should not be called on new records.
283 Example:
284
285 User.first.update_column(:name, "sebastian") # => true
286
287 *Sebastian Martinez*
288
289 * Associations with a :through option can now use *any* association as the
290 through or source association, including other associations which have a
291 :through option and has_and_belongs_to_many associations
292
293 *Jon Leighton*
294
295 * The configuration for the current database connection is now accessible via
296 ActiveRecord::Base.connection_config. *fxn*
297
298 * limits and offsets are removed from COUNT queries unless both are supplied.
299 For example:
300
301 People.limit(1).count # => 'SELECT COUNT(*) FROM people'
302 People.offset(1).count # => 'SELECT COUNT(*) FROM people'
303 People.limit(1).offset(1).count # => 'SELECT COUNT(*) FROM people LIMIT 1 OFFSET 1'
304
305 *lighthouse #6262*
306
307 * ActiveRecord::Associations::AssociationProxy has been split. There is now an Association class
308 (and subclasses) which are responsible for operating on associations, and then a separate,
309 thin wrapper called CollectionProxy, which proxies collection associations.
310
311 This prevents namespace pollution, separates concerns, and will allow further refactorings.
312
313 Singular associations (has_one, belongs_to) no longer have a proxy at all. They simply return
314 the associated record or nil. This means that you should not use undocumented methods such
315 as bob.mother.create - use bob.create_mother instead.
316
317 *Jon Leighton*
318
319 * Make has_many :through associations work correctly when you build a record and then save it. This
320 requires you to set the :inverse_of option on the source reflection on the join model, like so:
321
322 class Post < ActiveRecord::Base
323 has_many :taggings
324 has_many :tags, :through => :taggings
325 end
326
327 class Tagging < ActiveRecord::Base
328 belongs_to :post
329 belongs_to :tag, :inverse_of => :tagging # :inverse_of must be set!
330 end
331
332 class Tag < ActiveRecord::Base
333 has_many :taggings
334 has_many :posts, :through => :taggings
335 end
336
337 post = Post.first
338 tag = post.tags.build :name => "ruby"
339 tag.save # will save a Taggable linking to the post
340
341 *Jon Leighton*
342
343 * Support the :dependent option on has_many :through associations. For historical and practical
344 reasons, :delete_all is the default deletion strategy employed by association.delete(*records),
345 despite the fact that the default strategy is :nullify for regular has_many. Also, this only
346 works at all if the source reflection is a belongs_to. For other situations, you should directly
347 modify the through association.
348
349 *Jon Leighton*
350
351 * Changed the behaviour of association.destroy for has_and_belongs_to_many and has_many :through.
352 From now on, 'destroy' or 'delete' on an association will be taken to mean 'get rid of the link',
353 not (necessarily) 'get rid of the associated records'.
354
355 Previously, has_and_belongs_to_many.destroy(*records) would destroy the records themselves. It
356 would not delete any records in the join table. Now, it deletes the records in the join table.
357
358 Previously, has_many_through.destroy(*records) would destroy the records themselves, and the
359 records in the join table. [Note: This has not always been the case; previous version of Rails
360 only deleted the records themselves.] Now, it destroys only the records in the join table.
361
362 Note that this change is backwards-incompatible to an extent, but there is unfortunately no
363 way to 'deprecate' it before changing it. The change is being made in order to have
364 consistency as to the meaning of 'destroy' or 'delete' across the different types of associations.
365
366 If you wish to destroy the records themselves, you can do records.association.each(&:destroy)
367
368 *Jon Leighton*
369
370 * Add :bulk => true option to change_table to make all the schema changes defined in change_table block using a single ALTER statement. *Pratik Naik*
371
372 Example:
373
374 change_table(:users, :bulk => true) do |t|
375 t.string :company_name
376 t.change :birthdate, :datetime
377 end
378
379 This will now result in:
380
381 ALTER TABLE `users` ADD COLUMN `company_name` varchar(255), CHANGE `updated_at` `updated_at` datetime DEFAULT NULL
382
383 * Removed support for accessing attributes on a has_and_belongs_to_many join table. This has been
384 documented as deprecated behaviour since April 2006. Please use has_many :through instead.
385 *Jon Leighton*
386
387 * Added a create_association! method for has_one and belongs_to associations. *Jon Leighton*
388
389 * Migration files generated from model and constructive migration generators
390 (for example, add_name_to_users) use the reversible migration's `change`
391 method instead of the ordinary `up` and `down` methods. *Prem Sichanugrist*
392
393 * Removed support for interpolating string SQL conditions on associations. Instead, you should
394 use a proc, like so:
395
396 Before:
397
398 has_many :things, :conditions => 'foo = #{bar}'
399
400 After:
401
402 has_many :things, :conditions => proc { "foo = #{bar}" }
403
404 Inside the proc, 'self' is the object which is the owner of the association, unless you are
405 eager loading the association, in which case 'self' is the class which the association is within.
406
407 You can have any "normal" conditions inside the proc, so the following will work too:
408
409 has_many :things, :conditions => proc { ["foo = ?", bar] }
410
411 Previously :insert_sql and :delete_sql on has_and_belongs_to_many association allowed you to call
412 'record' to get the record being inserted or deleted. This is now passed as an argument to
413 the proc.
414
415 * Added ActiveRecord::Base#has_secure_password (via ActiveModel::SecurePassword) to encapsulate dead-simple password usage with BCrypt encryption and salting [DHH]. Example:
416
417 # Schema: User(name:string, password_digest:string, password_salt:string)
418 class User < ActiveRecord::Base
419 has_secure_password
420 end
421
422 user = User.new(:name => "david", :password => "", :password_confirmation => "nomatch")
423 user.save # => false, password required
424 user.password = "mUc3m00RsqyRe"
425 user.save # => false, confirmation doesn't match
426 user.password_confirmation = "mUc3m00RsqyRe"
427 user.save # => true
428 user.authenticate("notright") # => false
429 user.authenticate("mUc3m00RsqyRe") # => user
430 User.find_by_name("david").try(:authenticate, "notright") # => nil
431 User.find_by_name("david").try(:authenticate, "mUc3m00RsqyRe") # => user
432
433
434 * When a model is generated add_index is added by default for belongs_to or references columns
435
436 rails g model post user:belongs_to will generate the following:
437
438 class CreatePosts < ActiveRecord::Migration
439 def change
440 create_table :posts do |t|
441 t.belongs_to :user
442 t.timestamps
443 end
444 add_index :posts, :user_id
445 end
446 end
447
448 *Santiago Pastorino*
449
450 * Setting the id of a belongs_to object will update the reference to the
451 object. *#2989 state:resolved*
452
453 * ActiveRecord::Base#dup and ActiveRecord::Base#clone semantics have changed
454 to closer match normal Ruby dup and clone semantics.
455
456 * Calling ActiveRecord::Base#clone will result in a shallow copy of the record,
457 including copying the frozen state. No callbacks will be called.
458
459 * Calling ActiveRecord::Base#dup will duplicate the record, including calling
460 after initialize hooks. Frozen state will not be copied, and all associations
461 will be cleared. A duped record will return true for new_record?, have a nil
462 id field, and is saveable.
463
464 * Migrations can be defined as reversible, meaning that the migration system
465 will figure out how to reverse your migration. To use reversible migrations,
466 just define the "change" method. For example:
467
468 class MyMigration < ActiveRecord::Migration
469 def change
470 create_table(:horses) do
471 t.column :content, :text
472 t.column :remind_at, :datetime
473 end
474 end
475 end
476
477 Some things cannot be automatically reversed for you. If you know how to
478 reverse those things, you should define 'up' and 'down' in your migration. If
479 you define something in `change` that cannot be reversed, an
480 IrreversibleMigration exception will be raised when going down.
481
482 * Migrations should use instance methods rather than class methods:
483 class FooMigration < ActiveRecord::Migration
484 def up
485 ...
486 end
487 end
488
489 *Aaron Patterson*
490
491 * has_one maintains the association with separate after_create/after_update instead
492 of a single after_save. *fxn*
493
494 * The following code:
495
496 Model.limit(10).scoping { Model.count }
497
498 now generates the following SQL:
499
500 SELECT COUNT(*) FROM models LIMIT 10
501
502 This may not return what you want. Instead, you may with to do something
503 like this:
504
505 Model.limit(10).scoping { Model.all.size }
506
507 *Aaron Patterson*
508
509
510 ## Rails 3.0.7 (April 18, 2011) ##
511
512 * Destroying records via nested attributes works independent of reject_if LH #6006 *Durran Jordan*
513
514 * Delegate any? and many? to Model.scoped for consistency *Andrew White*
515
516 * Quote the ORDER BY clause in batched finds - fixes #6620 *Andrew White*
517
518 * Change exists? so records are not instantiated - fixes #6127. This prevents after_find
519 and after_initialize callbacks being triggered when checking for record existence.
520 *Andrew White*
521
522 * Fix performance bug with attribute accessors which only occurred on Ruby 1.8.7, and ensure we
523 cache type-casted values when the column returned from the db contains non-standard chars.
524 *Jon Leighton*
525
526 * Fix a performance regression introduced here 86acbf1cc050c8fa8c74a10c735e467fb6fd7df8
527 related to read_attribute method *Stian Grytøyr*
528
529
530 ## Rails 3.0.6 (April 5, 2011) ##
531
532 * Un-deprecate reorder method *Sebastian Martinez*
533
534 * Extensions are applied when calling +except+ or +only+ on relations.
535 Thanks to Iain Hecker.
536
537 * Schemas set in set_table_name are respected by the mysql adapter. LH #5322
538
539 * Fixed a bug when empty? was called on a grouped Relation that wasn't loaded.
540 LH #5829
541
542 * Reapply extensions when using except and only. Thanks Iain Hecker.
543
544 * Binary data is escaped when being inserted to SQLite3 Databases. Thanks
545 Naruse!
546
547
548 ## Rails 3.0.5 (February 26, 2011) ##
549
550 * Model.where(:column => 1).where(:column => 2) will always produce an AND
551 query.
552
553 *Aaron Patterson*
554
555 * Deprecated support for interpolated association conditions in the form of :conditions => 'foo = #{bar}'.
556
557 Instead, you should use a proc, like so:
558
559 Before:
560
561 has_many :things, :conditions => 'foo = #{bar}'
562
563 After:
564
565 has_many :things, :conditions => proc { "foo = #{bar}" }
566
567 Inside the proc, 'self' is the object which is the owner of the association, unless you are
568 eager loading the association, in which case 'self' is the class which the association is within.
569
570 You can have any "normal" conditions inside the proc, so the following will work too:
571
572 has_many :things, :conditions => proc { ["foo = ?", bar] }
573
574 Previously :insert_sql and :delete_sql on has_and_belongs_to_many association allowed you to call
575 'record' to get the record being inserted or deleted. This is now passed as an argument to
576 the proc.
577
578 *Jon Leighton*
579
580
581 ## Rails 3.0.4 (February 8, 2011) ##
582
583 * Added deprecation warning for has_and_belongs_to_many associations where the join table has
584 additional attributes other than the keys. Access to these attributes is removed in 3.1.
585 Please use has_many :through instead. *Jon Leighton*
586
587
588 ## Rails 3.0.3 (November 16, 2010) ##
589
590 * Support find by class like this: Post.where(:name => Post)
591
592
593 ## Rails 3.0.2 (November 15, 2010) ##
594
595 * Dramatic speed increase (see: http://engineering.attinteractive.com/2010/10/arel-two-point-ohhhhh-yaaaaaa/) *Aaron Patterson*
596
597 * reorder is deprecated in favor of except(:order).order(...) *Santiago Pastorino*
598
599 * except is now AR public API
600
601 Model.order('name').except(:order).order('salary')
602
603 generates:
604
605 SELECT * FROM models ORDER BY salary
606
607 *Santiago Pastorino*
608
609 * The following code:
610
611 Model.limit(10).scoping { Model.count }
612
613 now generates the following SQL:
614
615 SELECT COUNT(*) FROM models LIMIT 10
616
617 This may not return what you want. Instead, you may with to do something
618 like this:
619
620 Model.limit(10).scoping { Model.all.size }
621
622 *Aaron Patterson*
623
624
625 ## Rails 3.0.1 (October 15, 2010) ##
626
627 * Introduce a fix for CVE-2010-3993
628
629
630 ## Rails 3.0.0 (August 29, 2010) ##
631
632 * Changed update_attribute to not run callbacks and update the record directly in the database *Neeraj Singh*
633
634 * Add scoping and unscoped as the syntax to replace the old with_scope and with_exclusive_scope *José Valim*
635
636 * New rake task, db:migrate:status, displays status of migrations #4947 *Kevin Skoglund*
637
638 * select and order for ActiveRecord now always concatenate nested calls. Use reorder if you want the original order to be overwritten *Santiago Pastorino*
639
640 * PostgreSQL: ensure the database time zone matches Ruby's time zone #4895 *Aaron Patterson*
641
642 * Fixed that ActiveRecord::Base.compute_type would swallow NoMethodError #4751 *Andrew Bloomgarden, Andrew White*
643
644 * Add index length support for MySQL. #1852 *Emili Parreno, Pratik Naik*
645
646 Example:
647
648 add_index(:accounts, :name, :name => 'by_name', :length => 10)
649 => CREATE INDEX by_name ON accounts(name(10))
650
651 add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :length => {:name => 10, :surname => 15})
652 => CREATE INDEX by_name_surname ON accounts(name(10), surname(15))
653
654 * find_or_create_by_attr(value, ...) works when attr is protected. #4457 *Santiago Pastorino, Marc-André Lafortune*
655
656 * New callbacks: after_commit and after_rollback. Do expensive operations like image thumbnailing after_commit instead of after_save. #2991 *Brian Durand*
657
658 * Serialized attributes are not converted to YAML if they are any of the formats that can be serialized to XML (like Hash, Array and Strings). *José Valim*
659
660 * Destroy uses optimistic locking. If lock_version on the record you're destroying doesn't match lock_version in the database, a StaleObjectError is raised. #1966 *Curtis Hawthorne*
661
662 * PostgreSQL: drop support for old postgres driver. Use pg 0.9.0 or later. *Jeremy Kemper*
663
664 * Observers can prevent records from saving by returning false, just like before_save and friends. #4087 *Mislav Marohnić*
665
666 * Add Relation extensions. *Pratik Naik*
667
668 users = User.where(:admin => true).extending(User::AdminPowers)
669
670 latest_users = User.order('created_at DESC') do
671 def posts_count
672 Post.count(:user_id => to_a.map(&:id))
673 end
674 end
675
676 * To prefix the table names of all models in a module, define self.table_name_prefix on the module. #4032 *Andrew White*
677
678 * Silenced "SHOW FIELDS" and "SET SQL_AUTO_IS_NULL=0" statements from the MySQL driver to improve log signal to noise ration in development *DHH*
679
680 * PostgreSQLAdapter: set time_zone to UTC when Base.default_timezone == :utc so that Postgres doesn't incorrectly offset-adjust values inserted into TIMESTAMP WITH TIME ZONE columns. #3777 *Jack Christensen*
681
682 * Allow relations to be used as scope.
683
684 class Item
685 scope :red, where(:colour => 'red')
686 end
687
688 Item.red.limit(10) # Ten red items
689
690 * Rename named_scope to scope. *Pratik Naik*
691
692 * Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default *DHH*
693
694 * Add Relation#except. *Pratik Naik*
695
696 one_red_item = Item.where(:colour => 'red').limit(1)
697 all_items = one_red_item.except(:where, :limit)
698
699 * Add Relation#delete_all. *Pratik Naik*
700
701 Item.where(:colour => 'red').delete_all
702
703 * Add Model.having and Relation#having. *Pratik Naik*
704
705 Developer.group("salary").having("sum(salary) > 10000").select("salary")
706
707 * Add Relation#count. *Pratik Naik*
708
709 legends = People.where("age > 100")
710 legends.count
711 legends.count(:age, :distinct => true)
712 legends.select('id').count
713
714 * Add Model.readonly and association_collection#readonly finder method. *Pratik Naik*
715
716 Post.readonly.to_a # Load all posts in readonly mode
717 @user.items.readonly(false).to_a # Load all the user items in writable mode
718
719 * Add .lock finder method *Pratik Naik*
720
721 User.lock.where(:name => 'lifo').to_a
722
723 old_items = Item.where("age > 100")
724 old_items.lock.each {|i| .. }
725
726 * Add Model.from and association_collection#from finder methods *Pratik Naik*
727
728 user = User.scoped
729 user.select('*').from('users, items')
730
731 * Add relation.destroy_all *Pratik Naik*
732
733 old_items = Item.where("age > 100")
734 old_items.destroy_all
735
736 * Add relation.exists? *Pratik Naik*
737
738 red_items = Item.where(:colours => 'red')
739 red_items.exists?
740 red_items.exists?(1)
741
742 * Add find(ids) to relations. *Pratik Naik*
743
744 old_users = User.order("age DESC")
745 old_users.find(1)
746 old_users.find(1, 2, 3)
747
748 * Add new finder methods to association collection. *Pratik Naik*
749
750 class User < ActiveRecord::Base
751 has_many :items
752 end
753
754 user = User.first
755 user.items.where(:items => {:colour => 'red'})
756 user.items.select('items.id')
757
758 * Add relation.reload to force reloading the records. *Pratik Naik*
759
760 topics = Topic.scoped
761 topics.to_a # force load
762 topics.first # returns a cached record
763 topics.reload
764 topics.first # Fetches a new record from the database
765
766 * Rename Model.conditions and relation.conditions to .where. *Pratik Naik*
767
768 Before :
769 User.conditions(:name => 'lifo')
770 User.select('id').conditions(["age > ?", 21])
771
772 Now :
773 User.where(:name => 'lifo')
774 User.select('id').where(["age > ?", 21])
775
776 * Add Model.select/group/order/limit/joins/conditions/preload/eager_load class methods returning a lazy relation. *Pratik Naik*
777
778 Examples :
779
780 posts = Post.select('id).order('name') # Returns a lazy relation
781 posts.each {|p| puts p.id } # Fires "select id from posts order by name"
782
783 * Model.scoped now returns a relation if invoked without any arguments. *Pratik Naik*
784
785 Example :
786
787 posts = Post.scoped
788 posts.size # Fires "select count(*) from posts" and returns the count
789 posts.each {|p| puts p.name } # Fires "select * from posts" and loads post objects
790
791 * Association inverses for belongs_to, has_one, and has_many. Optimization to reduce database queries. #3533 *Murray Steele*
792
793 # post.comments sets each comment's post without needing to :include
794 class Post < ActiveRecord::Base
795 has_many :comments, :inverse_of => :post
796 end
797
798 * MySQL: add_ and change_column support positioning. #3286 *Ben Marini*
799
800 * Reset your Active Record counter caches with the reset_counter_cache class method. #1211 *Mike Breen, Gabe da Silveira*
801
802 * Remove support for SQLite 2. Please upgrade to SQLite 3+ or install the plugin from git://github.com/rails/sqlite2_adapter.git *Pratik Naik*
803
804 * PostgreSQL: XML datatype support. #1874 *Leonardo Borges*
805
806 * 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*
807
808 * SQLite: drop support for 'dbfile' option in favor of 'database.' #2363 *Paul Hinze, Jeremy Kemper*
809
810 * Added :primary_key option to belongs_to associations. #765 *Szymon Nowak, Philip Hallstrom, Noel Rocha*
811 # employees.company_name references companies.name
812 Employee.belongs_to :company, :primary_key => 'name', :foreign_key => 'company_name'
813
814 * Implement #many? for NamedScope and AssociationCollection using #size. #1500 *Chris Kampmeier*
815
816 * Added :touch option to belongs_to associations that will touch the parent record when the current record is saved or destroyed *DHH*
817
818 * Added ActiveRecord::Base#touch to update the updated_at/on attributes (or another specified timestamp) with the current time *DHH*
819
820
821 ## 2.3.2 Final (March 15, 2009) ##
822
823 * Added ActiveRecord::Base.find_each and ActiveRecord::Base.find_in_batches for batch processing *DHH/Jamis Buck*
824
825 * Added that ActiveRecord::Base.exists? can be called with no arguments #1817 *Scott Taylor*
826
827 * Add Support for updating deeply nested models from a single form. #1202 *Eloy Duran*
828
829 class Book < ActiveRecord::Base
830 has_one :author
831 has_many :pages
832
833 accepts_nested_attributes_for :author, :pages
834 end
835
836 * Make after_save callbacks fire only if the record was successfully saved. #1735 *Michael Lovitt*
837
838 Previously the callbacks would fire if a before_save cancelled saving.
839
840 * Support nested transactions using database savepoints. #383 *Jonathan Viney, Hongli Lai*
841
842 * Added dynamic scopes ala dynamic finders #1648 *Yaroslav Markin*
843
844 * Fixed that ActiveRecord::Base#new_record? should return false (not nil) for existing records #1219 *Yaroslav Markin*
845
846 * I18n the word separator for error messages. Introduces the activerecord.errors.format.separator translation key. #1294 *Akira Matsuda*
847
848 * Add :having as a key to find and the relevant associations. *Emilio Tagua*
849
850 * Added default_scope to Base #1381 [Paweł Kondzior]. Example:
851
852 class Person < ActiveRecord::Base
853 default_scope :order => 'last_name, first_name'
854 end
855
856 class Company < ActiveRecord::Base
857 has_many :people
858 end
859
860 Person.all # => Person.find(:all, :order => 'last_name, first_name')
861 Company.find(1).people # => Person.find(:all, :order => 'last_name, first_name', :conditions => { :company_id => 1 })
862
863
864 ## 2.2.1 RC2 (November 14th, 2008) ##
865
866 * Ensure indices don't flip order in schema.rb #1266 *Jordi Bunster*
867
868 * Fixed that serialized strings should never be type-casted (i.e. turning "Yes" to a boolean) #857 *Andreas Korth*
869
870
871 ## 2.2.0 RC1 (October 24th, 2008) ##
872
873 * Skip collection ids reader optimization if using :finder_sql *Jeremy Kemper*
874
875 * Add Model#delete instance method, similar to Model.delete class method. #1086 *Hongli Lai (Phusion)*
876
877 * MySQL: cope with quirky default values for not-null text columns. #1043 *Frederick Cheung*
878
879 * Multiparameter attributes skip time zone conversion for time-only columns [#1030 state:resolved] *Geoff Buesing*
880
881 * Base.skip_time_zone_conversion_for_attributes uses class_inheritable_accessor, so that subclasses don't overwrite Base [#346 state:resolved] *Emilio Tagua*
882
883 * Added find_last_by dynamic finder #762 *Emilio Tagua*
884
885 * Internal API: configurable association options and build_association method for reflections so plugins may extend and override. #985 *Hongli Lai (Phusion)*
886
887 * Changed benchmarks to be reported in milliseconds *David Heinemeier Hansson*
888
889 * Connection pooling. #936 *Nick Sieger*
890
891 * Merge scoped :joins together instead of overwriting them. May expose scoping bugs in your code! #501 *Andrew White*
892
893 * 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*
894
895 * Transactional migrations for databases which support them. #834 *divoxx, Adam Wiggins, Tarmo Tänav*
896
897 * Set config.active_record.timestamped_migrations = false to have migrations with numeric prefix instead of UTC timestamp. #446. *Andrew Stone, Nik Wakelin*
898
899 * change_column_default preserves the not-null constraint. #617 *Tarmo Tänav*
900
901 * Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) *#334*
902
903 * Add :tokenizer option to validates_length_of to specify how to split up the attribute string. #507. [David Lowenfels] Example :
904
905 \# Ensure essay contains at least 100 words.
906 validates_length_of :essay, :minimum => 100, :too_short => "Your essay must be at least %d words."), :tokenizer => lambda {|str| str.scan(/\w+/) }
907
908 * Allow conditions on multiple tables to be specified using hash. [Pratik Naik]. Example:
909
910 User.all :joins => :items, :conditions => { :age => 10, :items => { :color => 'black' } }
911 Item.first :conditions => { :items => { :color => 'red' } }
912
913 * Always treat integer :limit as byte length. #420 *Tarmo Tänav*
914
915 * Partial updates don't update lock_version if nothing changed. #426 *Daniel Morrison*
916
917 * Fix column collision with named_scope and :joins. #46 *Duncan Beevers, Mark Catley*
918
919 * db:migrate:down and :up update schema_migrations. #369 *Michael Raidel, RaceCondition*
920
921 * PostgreSQL: support :conditions => [':foo::integer', { :foo => 1 }] without treating the ::integer typecast as a bind variable. *Tarmo Tänav*
922
923 * MySQL: rename_column preserves column defaults. #466 *Diego Algorta*
924
925 * Add :from option to calculations. #397 *Ben Munat*
926
927 * Add :validate option to associations to enable/disable the automatic validation of associated models. Resolves #301. *Jan De Poorter*
928
929 * PostgreSQL: use 'INSERT ... RETURNING id' for 8.2 and later. *Jeremy Kemper*
930
931 * Added SQL escaping for :limit and :offset in MySQL *Jonathan Wiess*
932
933
934 ## 2.1.0 (May 31st, 2008) ##
935
936 * Add ActiveRecord::Base.sti_name that checks ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. *Rick Olson*
937
938 * Add first/last methods to associations/named_scope. Resolved #226. *Ryan Bates*
939
940 * Added SQL escaping for :limit and :offset #288 *Aaron Bedra, Steven Bristol, Jonathan Wiess*
941
942 * Added first/last methods to associations/named_scope. Resolved #226. *Ryan Bates*
943
944 * Ensure hm:t preloading honours reflection options. Resolves #137. *Frederick Cheung*
945
946 * Added protection against duplicate migration names (Aslak Hellesøy) *#112*
947
948 * 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*
949
950 * 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*
951
952 * Added change_table for migrations (Jeff Dean) [#71]. Example:
953
954 change_table :videos do |t|
955 t.timestamps # adds created_at, updated_at
956 t.belongs_to :goat # adds goat_id integer
957 t.string :name, :email, :limit => 20 # adds name and email both with a 20 char limit
958 t.remove :name, :email # removes the name and email columns
959 end
960
961 * Fixed has_many :through .create with no parameters caused a "can't dup NilClass" error (Steven Soroka) *#85*
962
963 * Added block-setting of attributes for Base.create like Base.new already has (Adam Meehan) *#39*
964
965 * Fixed that pessimistic locking you reference the quoted table name (Josh Susser) *#67*
966
967 * Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] *#26*
968
969 * Added that the MySQL adapter should map integer to either smallint, int, or bigint depending on the :limit just like PostgreSQL *David Heinemeier Hansson*
970
971 * Change validates_uniqueness_of :case_sensitive option default back to true (from [9160]). Love your database columns, don't LOWER them. *Rick Olson*
972
973 * Add support for interleaving migrations by storing which migrations have run in the new schema_migrations table. Closes #11493 *Jordi Bunster*
974
975 * ActiveRecord::Base#sum defaults to 0 if no rows are returned. Closes #11550 *Kamal Fariz Mahyuddin*
976
977 * Ensure that respond_to? considers dynamic finder methods. Closes #11538. *James Mead*
978
979 * Ensure that save on parent object fails for invalid has_one association. Closes #10518. *Pratik Naik*
980
981 * Remove duplicate code from associations. *Pratik Naik*
982
983 * Refactor HasManyThroughAssociation to inherit from HasManyAssociation. Association callbacks and <association>_ids= now work with hm:t. #11516 *Ruy Asan*
984
985 * Ensure HABTM#create and HABTM#build do not load entire association. *Pratik Naik*
986
987 * Improve documentation. *Xavier Noria, Jack Danger Canty, leethal*
988
989 * Tweak ActiveRecord::Base#to_json to include a root value in the returned hash: {"post": {"title": ...}} *Rick Olson*
990
991 Post.find(1).to_json # => {"title": ...}
992 config.active_record.include_root_in_json = true
993 Post.find(1).to_json # => {"post": {"title": ...}}
994
995 * Add efficient #include? to AssociationCollection (for has_many/has_many :through/habtm). *stopdropandrew*
996
997 * PostgreSQL: create_ and drop_database support. #9042 *ez, pedz, Nick Sieger*
998
999 * Ensure that validates_uniqueness_of works with with_scope. Closes #9235. *Nik Wakelin, cavalle*
1000
1001 * Partial updates include only unsaved attributes. Off by default; set YourClass.partial_updates = true to enable. *Jeremy Kemper*
1002
1003 * Removing unnecessary uses_tzinfo helper from tests, given that TZInfo is now bundled *Geoff Buesing*
1004
1005 * Fixed that validates_size_of :within works in associations #11295, #10019 *cavalle*
1006
1007 * Track changes to unsaved attributes. *Jeremy Kemper*
1008
1009 * 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*
1010
1011 * Fixed that has_many :through would ignore the hash conditions #11447 *Emilio Tagua*
1012
1013 * Fix issue where the :uniq option of a has_many :through association is ignored when find(:all) is called. Closes #9407 *cavalle*
1014
1015 * Fix duplicate table alias error when including an association with a has_many :through association on the same join table. Closes #7310 *cavalle*
1016
1017 * More efficient association preloading code that compacts a through_records array in a central location. Closes #11427 *Jack Danger Canty*
1018
1019 * Improve documentation. *Ryan Bigg, Jan De Poorter, Cheah Chu Yeow, Xavier Shay, Jack Danger Canty, Emilio Tagua, Xavier Noria, Sunny Ripert*
1020
1021 * Fixed that ActiveRecord#Base.find_or_create/initialize would not honor attr_protected/accessible when used with a hash #11422 *Emilio Tagua*
1022
1023 * Added ActiveRecord#Base.all/first/last as aliases for find(:all/:first/:last) #11413 *nkallen, Chris O'Sullivan*
1024
1025 * Merge the has_finder gem, renamed as 'named_scope'. #11404 *nkallen*
1026
1027 class Article < ActiveRecord::Base
1028 named_scope :published, :conditions => {:published => true}
1029 named_scope :popular, :conditions => ...
1030 end
1031
1032 Article.published.paginate(:page => 1)
1033 Article.published.popular.count
1034 Article.popular.find(:first)
1035 Article.popular.find(:all, :conditions => {...})
1036
1037 See http://pivots.pivotallabs.com/users/nick/blog/articles/284-hasfinder-it-s-now-easier-than-ever-to-create-complex-re-usable-sql-queries
1038
1039 * Add has_one :through support. #4756 *Chris O'Sullivan*
1040
1041 * Migrations: create_table supports primary_key_prefix_type. #10314 *student, Chris O'Sullivan*
1042
1043 * Added logging for dependency load errors with fixtures #11056 *stuthulhu*
1044
1045 * Time zone aware attributes use Time#in_time_zone *Geoff Buesing*
1046
1047 * Fixed that scoped joins would not always be respected #6821 *Theory/Jack Danger Canty*
1048
1049 * Ensure that ActiveRecord::Calculations disambiguates field names with the table name. #11027 *cavalle*
1050
1051 * Added add/remove_timestamps to the schema statements for adding the created_at/updated_at columns on existing tables #11129 *jramirez*
1052
1053 * Added ActiveRecord::Base.find(:last) #11338 *Emilio Tagua*
1054
1055 * test_native_types expects DateTime.local_offset instead of DateTime.now.offset; fixes test breakage due to dst transition *Geoff Buesing*
1056
1057 * Add :readonly option to HasManyThrough associations. #11156 *Emilio Tagua*
1058
1059 * Improve performance on :include/:conditions/:limit queries by selectively joining in the pre-query. #9560 *dasil003*
1060
1061 * Perf fix: Avoid the use of named block arguments. Closes #11109 *adymo*
1062
1063 * PostgreSQL: support server versions 7.4 through 8.0 and the ruby-pg driver. #11127 *jdavis*
1064
1065 * Ensure association preloading doesn't break when an association returns nil. ##11145 *GMFlash*
1066
1067 * Make dynamic finders respect the :include on HasManyThrough associations. #10998. *cpytel*
1068
1069 * 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*
1070
1071 * Refactor ConnectionAdapters::Column.new_time: leverage DateTime failover behavior of Time#time_with_datetime_fallback *Geoff Buesing*
1072
1073 * Improve associations performance by using symbol callbacks instead of string callbacks. #11108 *adymo*
1074
1075 * Optimise the BigDecimal conversion code. #11110 *adymo*
1076
1077 * Introduce the :readonly option to all associations. Records from the association cannot be saved. #11084 *Emilio Tagua*
1078
1079 * Multiparameter attributes for time columns fail over to DateTime when out of range of Time *Geoff Buesing*
1080
1081 * Base#instantiate_time_object uses Time.zone.local() *Geoff Buesing*
1082
1083 * Add timezone-aware attribute readers and writers. #10982 *Geoff Buesing*
1084
1085 * Instantiating time objects in multiparameter attributes uses Time.zone if available. #10982 *Rick Olson*
1086
1087 * Add note about how ActiveRecord::Observer classes are initialized in a Rails app. #10980 *Xavier Noria*
1088
1089 * MySQL: omit text/blob defaults from the schema instead of using an empty string. #10963 *mdeiters*
1090
1091 * belongs_to supports :dependent => :destroy and :delete. #10592 *Jonathan Viney*
1092
1093 * Introduce preload query strategy for eager :includes. #9640 *Frederick Cheung, Aliaksey Kandratsenka, codafoo*
1094
1095 * Support aggregations in finder conditions. #10572 *Ryan Kinderman*
1096
1097 * Organize and clean up the Active Record test suite. #10742 *John Barnette*
1098
1099 * Ensure that modifying has_and_belongs_to_many actions clear the query cache. Closes #10840 *john.andrews*
1100
1101 * Fix issue where Table#references doesn't pass a :null option to a *_type attribute for polymorphic associations. Closes #10753 *railsjitsu*
1102
1103 * Fixtures: removed support for the ancient pre-YAML file format. #10736 *John Barnette*
1104
1105 * More thoroughly quote table names. #10698 *dimdenis, lotswholetime, Jeremy Kemper*
1106
1107 * 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*
1108
1109 * Added ActiveRecord::Base.cache_key to make it easier to cache Active Records in combination with the new ActiveSupport::Cache::* libraries *David Heinemeier Hansson*
1110
1111 * Make sure CSV fixtures are compatible with ruby 1.9's new csv implementation. *JEG2*
1112
1113 * Added by parameter to increment, decrement, and their bang varieties so you can do player1.increment!(:points, 5) #10542 *Sam*
1114
1115 * Optimize ActiveRecord::Base#exists? to use #select_all instead of #find. Closes #10605 *jamesh, Frederick Cheung, protocool*
1116
1117 * Don't unnecessarily load has_many associations in after_update callbacks. Closes #6822 *stopdropandrew, canadaduane*
1118
1119 * Eager belongs_to :include infers the foreign key from the association name rather than the class name. #10517 *Jonathan Viney*
1120
1121 * SQLite: fix rename_ and remove_column for columns with unique indexes. #10576 *Brandon Keepers*
1122
1123 * Ruby 1.9 compatibility. #10655 *Jeremy Kemper, Dirkjan Bussink*
1124
1125
1126 ## 2.0.2 (December 16th, 2007) ##
1127
1128 * Ensure optimistic locking handles nil #lock_version values properly. Closes #10510 *Rick Olson*
1129
1130 * Make the Fixtures Test::Unit enhancements more supporting for double-loaded test cases. Closes #10379 *brynary*
1131
1132 * Fix that validates_acceptance_of still works for non-existent tables (useful for bootstrapping new databases). Closes #10474 *Josh Susser*
1133
1134 * Ensure that the :uniq option for has_many :through associations retains the order. #10463 *remvee*
1135
1136 * Base.exists? doesn't rescue exceptions to avoid hiding SQL errors. #10458 *Michael Klishin*
1137
1138 * Documentation: Active Record exceptions, destroy_all and delete_all. #10444, #10447 *Michael Klishin*
1139
1140
1141 ## 2.0.1 (December 7th, 2007) ##
1142
1143 * Removed query cache rescue as it could cause code to be run twice (closes #10408) *David Heinemeier Hansson*
1144
1145
1146 ## 2.0.0 (December 6th, 2007) ##
1147
1148 * 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*
1149
1150 * 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*
1151
1152 * Fixed that the truncation of strings longer than 50 chars should use inspect
1153 so newlines etc are escaped #10385 *Norbert Crombach*
1154
1155 * Fixed that habtm associations should be able to set :select as part of their definition and have that honored *David Heinemeier Hansson*
1156
1157 * Document how the :include option can be used in Calculations::calculate. Closes #7446 *adamwiggins, ultimoamore*
1158
1159 * Fix typo in documentation for polymorphic associations w/STI. Closes #7461 *johnjosephbachir*
1160
1161 * 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*
1162
1163 * More complete documentation for find_by_sql. Closes #7912 *fearoffish*
1164
1165 * Added ActiveRecord::Base#becomes to turn a record into one of another class (mostly relevant for STIs) [David Heinemeier Hansson]. Example:
1166
1167 render :partial => @client.becomes(Company) # renders companies/company instead of clients/client
1168
1169 * Fixed that to_xml should not automatically pass :procs to associations included with :include #10162 *Cheah Chu Yeow*
1170
1171 * Fix documentation typo introduced in [8250]. Closes #10339 *Henrik N*
1172
1173 * Foxy fixtures: support single-table inheritance. #10234 *tom*
1174
1175 * Foxy fixtures: allow mixed usage to make migration easier and more attractive. #10004 *lotswholetime*
1176
1177 * Make the record_timestamps class-inheritable so it can be set per model. #10004 *tmacedo*
1178
1179 * Allow validates_acceptance_of to use a real attribute instead of only virtual (so you can record that the acceptance occured) #7457 *ambethia*
1180
1181 * DateTimes use Ruby's default calendar reform setting. #10201 *Geoff Buesing*
1182
1183 * Dynamic finders on association collections respect association :order and :limit. #10211, #10227 *Patrick Joyce, Rick Olson, Jack Danger Canty*
1184
1185 * Add 'foxy' support for fixtures of polymorphic associations. #10183 *John Barnette, David Lowenfels*
1186
1187 * validates_inclusion_of and validates_exclusion_of allow formatted :message strings. #8132 *devrieda, Mike Naberezny*
1188
1189 * attr_readonly behaves well with optimistic locking. #10188 *Nick Bugajski*
1190
1191 * Base#to_xml supports the nil="true" attribute like Hash#to_xml. #8268 *Jonathan del Strother*
1192
1193 * Change plings to the more conventional quotes in the documentation. Closes #10104 *Jack Danger Canty*
1194
1195 * Fix HasManyThrough Association so it uses :conditions on the HasMany Association. Closes #9729 *Jack Danger Canty*
1196
1197 * Ensure that column names are quoted. Closes #10134 *wesley.moxam*
1198
1199 * Smattering of grammatical fixes to documentation. Closes #10083 *Bob Silva*
1200
1201 * Enhance explanation with more examples for attr_accessible macro. Closes #8095 *fearoffish, Marcel Molina Jr.*
1202
1203 * Update association/method mapping table to refected latest collection methods for has_many :through. Closes #8772 *Pratik Naik*
1204
1205 * Explain semantics of having several different AR instances in a transaction block. Closes #9036 *jacobat, Marcel Molina Jr.*
1206
1207 * Update Schema documentation to use updated sexy migration notation. Closes #10086 *Sam Granieri*
1208
1209 * Make fixtures work with the new test subclasses. *Tarmo Tänav, Michael Koziarski*
1210
1211 * Introduce finder :joins with associations. Same :include syntax but with inner rather than outer joins. #10012 *RubyRedRick*
1212 # Find users with an avatar
1213 User.find(:all, :joins => :avatar)
1214
1215 # Find posts with a high-rated comment.
1216 Post.find(:all, :joins => :comments, :conditions => 'comments.rating > 3')
1217
1218 * Associations: speedup duplicate record check. #10011 *Pratik Naik*
1219
1220 * Make sure that << works on has_many associations on unsaved records. Closes #9989 *Josh Susser*
1221
1222 * Allow association redefinition in subclasses. #9346 *wildchild*
1223
1224 * Fix has_many :through delete with custom foreign keys. #6466 *naffis*
1225
1226 * Foxy fixtures, from rathole (http://svn.geeksomnia.com/rathole/trunk/README)
1227 - stable, autogenerated IDs
1228 - specify associations (belongs_to, has_one, has_many) by label, not ID
1229 - specify HABTM associations as inline lists
1230 - autofill timestamp columns
1231 - support YAML defaults
1232 - fixture label interpolation
1233 Enabled for fixtures that correspond to a model class and don't specify a primary key value. #9981 *John Barnette*
1234
1235 * Add docs explaining how to protect all attributes using attr_accessible with no arguments. Closes #9631 *boone, rmm5t*
1236
1237 * Update add_index documentation to use new options api. Closes #9787 *Kamal Fariz Mahyuddin*
1238
1239 * Allow find on a has_many association defined with :finder_sql to accept id arguments as strings like regular find does. Closes #9916 *krishna*
1240
1241 * Use VALID_FIND_OPTIONS when resolving :find scoping rather than hard coding the list of valid find options. Closes #9443 *sur*
1242
1243 * Limited eager loading no longer ignores scoped :order. Closes #9561 *Jack Danger Canty, Josh Peek*
1244
1245 * 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*
1246
1247 * Assigning nil to a composed_of aggregate also sets its immediate value to nil. #9843 *Chris Cruft*
1248
1249 * Ensure that mysql quotes table names with database names correctly. Closes #9911 *crayz*
1250
1251 "foo.bar" => "`foo`.`bar`"
1252
1253 * Complete the assimilation of Sexy Migrations from ErrFree *Chris Wanstrath, PJ Hyett*
1254 http://errtheblog.com/post/2381
1255
1256 * Qualified column names work in hash conditions, like :conditions => { 'comments.created_at' => ... }. #9733 *Jack Danger Canty*
1257
1258 * 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*
1259
1260 * Refactor association create and build so before & after callbacks behave consistently. #8854 *Pratik Naik, mortent*
1261
1262 * Quote table names. Defaults to column quoting. #4593 *Justin Lynn, gwcoffey, eadz, Dmitry V. Sabanin, Jeremy Kemper*
1263
1264 * Alias association #build to #new so it behaves predictably. #8787 *Pratik Naik*
1265
1266 * Add notes to documentation regarding attr_readonly behavior with counter caches and polymorphic associations. Closes #9835 *saimonmoore, Rick Olson*
1267
1268 * Observers can observe model names as symbols properly now. Closes #9869 *queso*
1269
1270 * find_and_(initialize|create)_by methods can now properly initialize protected attributes *Tobias Lütke*
1271
1272 * belongs_to infers the foreign key from the association name instead of from the class name. *Jeremy Kemper*
1273
1274 * PostgreSQL: support multiline default values. #7533 *Carl Lerche, aguynamedryan, Rein Henrichs, Tarmo Tänav*
1275
1276 * MySQL: fix change_column on not-null columns that don't accept dfeault values of ''. #6663 *Jonathan Viney, Tarmo Tänav*
1277
1278 * validates_uniqueness_of behaves well with abstract superclasses and
1279 single-table inheritance. #3833, #9886 *Gabriel Gironda, rramdas, François Beausoleil, Josh Peek, Tarmo Tänav, pat*
1280
1281 * Warn about protected attribute assigments in development and test environments when mass-assigning to an attr_protected attribute. #9802 *Henrik N*
1282
1283 * Speedup database date/time parsing. *Jeremy Kemper, Tarmo Tänav*
1284
1285 * Fix calling .clear on a has_many :dependent=>:delete_all association. *Tarmo Tänav*
1286
1287 * Allow change_column to set NOT NULL in the PostgreSQL adapter *Tarmo Tänav*
1288
1289 * Fix that ActiveRecord would create attribute methods and override custom attribute getters if the method is also defined in Kernel.methods. *Rick Olson*
1290
1291 * 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*
1292
1293 * 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*
1294
1295
1296 ## 2.0.0 Preview Release (September 29th, 2007) Includes duplicates of changes from 1.14.2 - 1.15.3 ##
1297
1298 * Add attr_readonly to specify columns that are skipped during a normal ActiveRecord #save operation. Closes #6896 *Dan Manges*
1299
1300 class Comment < ActiveRecord::Base
1301 # Automatically sets Article#comments_count as readonly.
1302 belongs_to :article, :counter_cache => :comments_count
1303 end
1304
1305 class Article < ActiveRecord::Base
1306 attr_readonly :approved_comments_count
1307 end
1308
1309 * Make size for has_many :through use counter cache if it exists. Closes #9734 *Xavier Shay*
1310
1311 * Remove DB2 adapter since IBM chooses to maintain their own adapter instead. *Jeremy Kemper*
1312
1313 * Extract Oracle, SQLServer, and Sybase adapters into gems. *Jeremy Kemper*
1314
1315 * Added fixture caching that'll speed up a normal fixture-powered test suite between 50% and 100% #9682 *Frederick Cheung*
1316
1317 * Correctly quote id list for limited eager loading. #7482 *tmacedo*
1318
1319 * Fixed that using version-targetted migrates would fail on loggers other than the default one #7430 *valeksenko*
1320
1321 * Fixed rename_column for SQLite when using symbols for the column names #8616 *drodriguez*
1322
1323 * Added the possibility of using symbols in addition to concrete classes with ActiveRecord::Observer#observe. #3998 *Robby Russell, Tarmo Tänav*
1324
1325 * Added ActiveRecord::Base#to_json/from_json *David Heinemeier Hansson, Cheah Chu Yeow*
1326
1327 * Added ActiveRecord::Base#from_xml [David Heinemeier Hansson]. Example:
1328
1329 xml = "<person><name>David</name></person>"
1330 Person.new.from_xml(xml).name # => "David"
1331
1332 * Define dynamic finders as real methods after first usage. *bscofield*
1333
1334 * Deprecation: remove deprecated threaded_connections methods. Use allow_concurrency instead. *Jeremy Kemper*
1335
1336 * Associations macros accept extension blocks alongside modules. #9346 *Josh Peek*
1337
1338 * Speed up and simplify query caching. *Jeremy Kemper*
1339
1340 * connection.select_rows 'sql' returns an array (rows) of arrays (field values). #2329 *Michael Schuerig*
1341
1342 * Eager loading respects explicit :joins. #9496 *dasil003*
1343
1344 * Extract Firebird, FrontBase, and OpenBase adapters into gems. #9508, #9509, #9510 *Jeremy Kemper*
1345
1346 * RubyGem database adapters: expects a gem named activerecord-<database>-adapter with active_record/connection_adapters/<database>_adapter.rb in its load path. *Jeremy Kemper*
1347
1348 * Fixed that altering join tables in migrations would fail w/ sqlite3 #7453 *TimoMihaljov/brandon*
1349
1350 * Fix association writer with :dependent => :nullify. #7314 *Jonathan Viney*
1351
1352 * OpenBase: update for new lib and latest Rails. Support migrations. #8748 *dcsesq*
1353
1354 * Moved acts_as_tree into a plugin of the same name on the official Rails svn. #9514 *Pratik Naik*
1355
1356 * Moved acts_as_nested_set into a plugin of the same name on the official Rails svn. #9516 *Josh Peek*
1357
1358 * Moved acts_as_list into a plugin of the same name on the official Rails svn. *Josh Peek*
1359
1360 * Explicitly require active_record/query_cache before using it. *Jeremy Kemper*
1361
1362 * Fix bug where unserializing an attribute attempts to modify a frozen @attributes hash for a deleted record. *Rick Olson, marclove*
1363
1364 * Performance: absorb instantiate and initialize_with_callbacks into the Base methods. *Jeremy Kemper*
1365
1366 * Fixed that eager loading queries and with_scope should respect the :group option *David Heinemeier Hansson*
1367
1368 * Improve performance and functionality of the postgresql adapter. Closes #8049 *roderickvd*
1369
1370 For more information see: http://dev.rubyonrails.org/ticket/8049
1371
1372 * Don't clobber includes passed to has_many.count *Jack Danger Canty*
1373
1374 * Make sure has_many uses :include when counting *Jack Danger Canty*
1375
1376 * Change the implementation of ActiveRecord's attribute reader and writer methods *Michael Koziarski*
1377 - Generate Reader and Writer methods which cache attribute values in hashes. This is to avoid repeatedly parsing the same date or integer columns.
1378 - 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.
1379 - Move method definition to the class, instead of the instance
1380 - Always generate the readers, writers and predicate methods.
1381
1382 * Perform a deep #dup on query cache results so that modifying activerecord attributes does not modify the cached attributes. *Rick Olson*
1383
1384 \# Ensure that has_many :through associations use a count query instead of loading the target when #size is called. Closes #8800 *Pratik Naik*
1385
1386 * Added :unless clause to validations #8003 [monki]. Example:
1387
1388 def using_open_id?
1389 !identity_url.blank?
1390 end
1391
1392 validates_presence_of :identity_url, :if => using_open_id?
1393 validates_presence_of :username, :unless => using_open_id?
1394 validates_presence_of :password, :unless => using_open_id?
1395
1396 * Fix #count on a has_many :through association so that it recognizes the :uniq option. Closes #8801 *Pratik Naik*
1397
1398 * Fix and properly document/test count(column_name) usage. Closes #8999 *Pratik Naik*
1399
1400 * Remove deprecated count(conditions=nil, joins=nil) usage. Closes #8993 *Pratik Naik*
1401
1402 * Change belongs_to so that the foreign_key assumption is taken from the association name, not the class name. Closes #8992 *Josh Susser*
1403
1404 OLD
1405 belongs_to :visitor, :class_name => 'User' # => inferred foreign_key is user_id
1406
1407 NEW
1408 belongs_to :visitor, :class_name => 'User' # => inferred foreign_key is visitor_id
1409
1410 * Remove spurious tests from deprecated_associations_test, most of these aren't deprecated, and are duplicated in associations_test. Closes #8987 *Pratik Naik*
1411
1412 * Make create! on a has_many :through association return the association object. Not the collection. Closes #8786 *Pratik Naik*
1413
1414 * Move from select * to select tablename.* to avoid clobbering IDs. Closes #8889 *dasil003*
1415
1416 * Don't call unsupported methods on associated objects when using :include, :method with to_xml #7307, *Manfred Stienstra, jwilger*
1417
1418 * Define collection singular ids method for has_many :through associations. #8763 *Pratik Naik*
1419
1420 * Array attribute conditions work with proxied association collections. #8318 *Kamal Fariz Mahyuddin, theamazingrando*
1421
1422 * Fix polymorphic has_one associations declared in an abstract class. #8638 *Pratik Naik, Dax Huiberts*
1423
1424 * Fixed validates_associated should not stop on the first error. #4276 *mrj, Manfred Stienstra, Josh Peek*
1425
1426 * Rollback if commit raises an exception. #8642 *kik, Jeremy Kemper*
1427
1428 * Update tests' use of fixtures for the new collections api. #8726 *Kamal Fariz Mahyuddin*
1429
1430 * Save associated records only if the association is already loaded. #8713 *Blaine*
1431
1432 * MySQL: fix show_variable. #8448 *matt, Jeremy Kemper*
1433
1434 * Fixtures: correctly delete and insert fixtures in a single transaction. #8553 *Michael Schuerig*
1435
1436 * Fixtures: people(:technomancy, :josh) returns both fixtures. #7880 *technomancy, Josh Peek*
1437
1438 * Calculations support non-numeric foreign keys. #8154 *Kamal Fariz Mahyuddin*
1439
1440 * with_scope is protected. #8524 *Josh Peek*
1441
1442 * Quickref for association methods. #7723 *marclove, Mindsweeper*
1443
1444 * Calculations: return nil average instead of 0 when there are no rows to average. #8298 *davidw*
1445
1446 * acts_as_nested_set: direct_children is sorted correctly. #4761 *Josh Peek, rails@33lc0.net*
1447
1448 * Raise an exception if both attr_protected and attr_accessible are declared. #8507 *stellsmi*
1449
1450 * SQLite, MySQL, PostgreSQL, Oracle: quote column names in column migration SQL statements. #8466 *marclove, lorenjohnson*
1451
1452 * Allow nil serialized attributes with a set class constraint. #7293 *sandofsky*
1453
1454 * Oracle: support binary fixtures. #7987 *Michael Schoen*
1455
1456 * Fixtures: pull fixture insertion into the database adapters. #7987 *Michael Schoen*
1457
1458 * Announce migration versions as they're performed. *Jeremy Kemper*
1459
1460 * find gracefully copes with blank :conditions. #7599 *Dan Manges, johnnyb*
1461
1462 * 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*
1463
1464 * MySQL: create_database takes :charset and :collation options. Charset defaults to utf8. #8448 *matt*
1465
1466 * Find with a list of ids supports limit/offset. #8437 *hrudududu*
1467
1468 * Optimistic locking: revert the lock version when an update fails. #7840 *plang*
1469
1470 * Migrations: add_column supports custom column types. #7742 *jsgarvin, Theory*
1471
1472 * 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*
1473
1474 * Ensure that associations with :dependent => :delete_all respect :conditions option. Closes #8034 *Jack Danger Canty, Josh Peek, Rick Olson*
1475
1476 * belongs_to assignment creates a new proxy rather than modifying its target in-place. #8412 *mmangino@elevatedrails.com*
1477
1478 * Fix column type detection while loading fixtures. Closes #7987 *roderickvd*
1479
1480 * Document deep eager includes. #6267 *Josh Susser, Dan Manges*
1481
1482 * Document warning that associations names shouldn't be reserved words. #4378 *murphy@cYcnus.de, Josh Susser*
1483
1484 * Sanitize Base#inspect. #8392, #8623 *Nik Wakelin, jnoon*
1485
1486 * Replace the transaction {|transaction|..} semantics with a new Exception ActiveRecord::Rollback. *Michael Koziarski*
1487
1488 * Oracle: extract column length for CHAR also. #7866 *ymendel*
1489
1490 * Document :allow_nil option for validates_acceptance_of since it defaults to true. *tzaharia*
1491
1492 * Update documentation for :dependent declaration so that it explicitly uses the non-deprecated API. *Jack Danger Canty*
1493
1494 * Add documentation caveat about when to use count_by_sql. *fearoffish*
1495
1496 * Enhance documentation for increment_counter and decrement_counter. *fearoffish*
1497
1498 * Provide brief introduction to what optimistic locking is. *fearoffish*
1499
1500 * Add documentation for :encoding option to mysql adapter. *marclove*
1501
1502 * Added short-hand declaration style to migrations (inspiration from Sexy Migrations, http://errtheblog.com/post/2381) [David Heinemeier Hansson]. Example:
1503
1504 create_table "products" do |t|
1505 t.column "shop_id", :integer
1506 t.column "creator_id", :integer
1507 t.column "name", :string, :default => "Untitled"
1508 t.column "value", :string, :default => "Untitled"
1509 t.column "created_at", :datetime
1510 t.column "updated_at", :datetime
1511 end
1512
1513 ...can now be written as:
1514
1515 create_table :products do |t|
1516 t.integer :shop_id, :creator_id
1517 t.string :name, :value, :default => "Untitled"
1518 t.timestamps
1519 end
1520
1521 * 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*
1522
1523 * Improve performance of calling .create on has_many :through associations. *evan*
1524
1525 * Improved cloning performance by relying less on exception raising #8159 *Blaine*
1526
1527 * Added ActiveRecord::Base.inspect to return a column-view like #<Post id:integer, title:string, body:text> *David Heinemeier Hansson*
1528
1529 * Added yielding of Builder instance for ActiveRecord::Base#to_xml calls *David Heinemeier Hansson*
1530
1531 * Small additions and fixes for ActiveRecord documentation. Closes #7342 *Jeremy McAnally*
1532
1533 * Add helpful debugging info to the ActiveRecord::StatementInvalid exception in ActiveRecord::ConnectionAdapters::SqliteAdapter#table_structure. Closes #7925. *court3nay*
1534
1535 * SQLite: binary escaping works with $KCODE='u'. #7862 *tsuka*
1536
1537 * Base#to_xml supports serialized attributes. #7502 *jonathan*
1538
1539 * Base.update_all :order and :limit options. Useful for MySQL updates that must be ordered to avoid violating unique constraints. *Jeremy Kemper*
1540
1541 * 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*
1542
1543 * 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*
1544
1545 * 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*
1546
1547 * 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*
1548
1549 * Allow a polymorphic :source for has_many :through associations. Closes #7143 *protocool*
1550
1551 * Consistent public/protected/private visibility for chained methods. #7813 *Dan Manges*
1552
1553 * Oracle: fix quoted primary keys and datetime overflow. #7798 *Michael Schoen*
1554
1555 * Consistently quote primary key column names. #7763 *toolmantim*
1556
1557 * Fixtures: fix YAML ordered map support. #2665 *Manuel Holtgrewe, nfbuckley*
1558
1559 * DateTimes assume the default timezone. #7764 *Geoff Buesing*
1560
1561 * Sybase: hide timestamp columns since they're inherently read-only. #7716 *Mike Joyce*
1562
1563 * Oracle: overflow Time to DateTime. #7718 *Michael Schoen*
1564
1565 * PostgreSQL: don't use async_exec and async_query with postgres-pr. #7727, #7762 *flowdelic, toolmantim*
1566
1567 * Fix has_many :through << with custom foreign keys. #6466, #7153 *naffis, Rich Collins*
1568
1569 * Test DateTime native type in migrations, including an edge case with dates
1570 during calendar reform. #7649, #7724 *fedot, Geoff Buesing*
1571
1572 * SQLServer: correctly schema-dump tables with no indexes or descending indexes. #7333, #7703 *Jakob Skjerning, Tom Ward*
1573
1574 * SQLServer: recognize real column type as Ruby float. #7057 *sethladd, Tom Ward*
1575
1576 * Added fixtures :all as a way of loading all fixtures in the fixture directory at once #7214 *Manfred Stienstra*
1577
1578 * Added database connection as a yield parameter to ActiveRecord::Base.transaction so you can manually rollback [David Heinemeier Hansson]. Example:
1579
1580 transaction do |transaction|
1581 david.withdrawal(100)
1582 mary.deposit(100)
1583 transaction.rollback! # rolls back the transaction that was otherwise going to be successful
1584 end
1585
1586 * Made increment_counter/decrement_counter play nicely with optimistic locking, and added a more general update_counters method *Jamis Buck*
1587
1588 * 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*
1589 Task.cache { Task.find(1); Task.find(1) } # => 1 query
1590
1591 * 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*
1592
1593 * Oracle: fix lob and text default handling. #7344 *gfriedrich, Michael Schoen*
1594
1595 * SQLServer: don't choke on strings containing 'null'. #7083 *Jakob Skjerning*
1596
1597 * MySQL: blob and text columns may not have defaults in 5.x. Update fixtures schema for strict mode. #6695 *Dan Kubb*
1598
1599 * 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*
1600
1601 * MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last inserted id. #6778 *Jonathan Viney, timc*
1602
1603 * Use Date#to_s(:db) for quoted dates. #7411 *Michael Schoen*
1604
1605 * Don't create instance writer methods for class attributes. Closes #7401 *Rick Olson*
1606
1607 * Docs: validations examples. #7343 *zackchandler*
1608
1609 * Add missing tests ensuring callbacks work with class inheritance. Closes #7339 *sandofsky*
1610
1611 * Fixtures use the table name and connection from set_fixture_class. #7330 *Anthony Eden*
1612
1613 * Remove useless code in #attribute_present? since 0 != blank?. Closes #7249 *Josh Susser*
1614
1615 * Fix minor doc typos. Closes #7157 *Josh Susser*
1616
1617 * Fix incorrect usage of #classify when creating the eager loading join statement. Closes #7044 *Josh Susser*
1618
1619 * SQLServer: quote table name in indexes query. #2928 *keithm@infused.org*
1620
1621 * Subclasses of an abstract class work with single-table inheritance. #5704, #7284 *BertG, nick+rails@ag.arizona.edu*
1622
1623 * Make sure sqlite3 driver closes open connections on disconnect *Rob Rasmussen*
1624
1625 * [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name. #7072 *Jeremy McAnally*
1626
1627 * change_column accepts :default => nil. Skip column options for primary keys. #6956, #7048 *Dan Manges, Jeremy Kemper*
1628
1629 * 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*
1630
1631 * Oracle: create_table takes a :sequence_name option to override the 'tablename_seq' default. #7000 *Michael Schoen*
1632
1633 * MySQL: retain SSL settings on reconnect. #6976 *randyv2*
1634
1635 * Apply scoping during initialize instead of create. Fixes setting of foreign key when using find_or_initialize_by with scoping. *Cody Fauser*
1636
1637 * SQLServer: handle [quoted] table names. #6635 *rrich*
1638
1639 * acts_as_nested_set works with single-table inheritance. #6030 *Josh Susser*
1640
1641 * PostgreSQL, Oracle: correctly perform eager finds with :limit and :order. #4668, #7021 *eventualbuddha, Michael Schoen*
1642
1643 * Pass a range in :conditions to use the SQL BETWEEN operator. #6974 *Dan Manges*
1644 Student.find(:all, :conditions => { :grade => 9..12 })
1645
1646 * Fix the Oracle adapter for serialized attributes stored in CLOBs. Closes #6825 *mschoen, tdfowler*
1647
1648 * [DOCS] Apply more documentation for ActiveRecord Reflection. Closes #4055 *Robby Russell*
1649
1650 * [DOCS] Document :allow_nil option of #validate_uniqueness_of. Closes #3143 *Caio Chassot*
1651
1652 * Bring the sybase adapter up to scratch for 1.2 release. *jsheets*
1653
1654 * Rollback new_record? and id when an exception is raised in a save callback. #6910 *Ben Curren, outerim*
1655
1656 * Pushing a record on an association collection doesn't unnecessarily load all the associated records. *Obie Fernandez, Jeremy Kemper*
1657
1658 * Oracle: fix connection reset failure. #6846 *leonlleslie*
1659
1660 * Subclass instantiation doesn't try to explicitly require the corresponding subclass. #6840 *leei, Jeremy Kemper*
1661
1662 * 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*
1663
1664 * 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*
1665
1666 * find supports :lock with :include. Check whether your database allows SELECT ... FOR UPDATE with outer joins before using. #6764 *vitaly, Jeremy Kemper*
1667
1668 * Add AssociationCollection#create! to be consistent with AssociationCollection#create when dealing with a foreign key that is a protected attribute *Cody Fauser*
1669
1670 * 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*
1671
1672 * Change fixture_path to a class inheritable accessor allowing test cases to have their own custom set of fixtures. #6672 *Zach Dennis*
1673
1674 * Quote ActiveSupport::Multibyte::Chars. #6653 *Julian Tarkhanov*
1675
1676 * Simplify query_attribute by typecasting the attribute value and checking whether it's nil, false, zero or blank. #6659 *Jonathan Viney*
1677
1678 * 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*
1679
1680 * Run validations in the order they were declared. #6657 *obrie*
1681
1682 * 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*
1683
1684 * Simplify association proxy implementation by factoring construct_scope out of method_missing. #6643 *martin*
1685
1686 * Oracle: automatically detect the primary key. #6594 *vesaria, Michael Schoen*
1687
1688 * 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*
1689
1690 * Don't inspect unloaded associations. #2905 *lmarlow*
1691
1692 * SQLite: use AUTOINCREMENT primary key in >= 3.1.0. #6588, #6616 *careo, lukfugl*
1693
1694 * Cache inheritance_column. #6592 *Stefan Kaes*
1695
1696 * Firebird: decimal/numeric support. #6408 *macrnic*
1697
1698 * make add_order a tad faster. #6567 *Stefan Kaes*
1699
1700 * Find with :include respects scoped :order. #5850
1701
1702 * Support nil and Array in :conditions => { attr => value } hashes. #6548 *Assaf, Jeremy Kemper*
1703 find(:all, :conditions => { :topic_id => [1, 2, 3], :last_read => nil }
1704
1705 * 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*
1706
1707 * SQLite: fix calculations workaround, remove count(distinct) query rewrite, cleanup test connection scripts. *Jeremy Kemper*
1708
1709 * SQLite: count(distinct) queries supported in >= 3.2.6. #6544 *Bob Silva*
1710
1711 * Dynamically generate reader methods for serialized attributes. #6362 *Stefan Kaes*
1712
1713 * Deprecation: object transactions warning. *Jeremy Kemper*
1714
1715 * has_one :dependent => :nullify ignores nil associates. #4848, #6528 *bellis@deepthought.org, janovetz, Jeremy Kemper*
1716
1717 * 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*
1718
1719 * Make add_column use the options hash with the Sqlite Adapter. Closes #6464 *obrie*
1720
1721 * Document other options available to migration's add_column. #6419 *grg*
1722
1723 * MySQL: all_hashes compatibility with old MysqlRes class. #6429, #6601 *Jeremy Kemper*
1724
1725 * Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes #5783. *Jonathan Viney*
1726
1727 * fix select_limited_ids_list issues in postgresql, retain current behavior in other adapters *Rick Olson*
1728
1729 * Restore eager condition interpolation, document it's differences *Rick Olson*
1730
1731 * 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*
1732
1733 * Add #delete support to has_many :through associations. Closes #6049 *Martin Landers*
1734
1735 * Reverted old select_limited_ids_list postgresql fix that caused issues in mysql. Closes #5851 *Rick Olson*
1736
1737 * 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*
1738
1739 * 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*
1740
1741 * Added update_attributes! which uses save! to raise an exception if a validation error prevents saving #6192 *jonathan*
1742
1743 * Deprecated add_on_boundary_breaking (use validates_length_of instead) #6292 *Bob Silva*
1744
1745 * The has_many create method works with polymorphic associations. #6361 *Dan Peterson*
1746
1747 * MySQL: introduce Mysql::Result#all_hashes to support further optimization. #5581 *Stefan Kaes*
1748
1749 * save! shouldn't validate twice. #6324 *maiha, Bob Silva*
1750
1751 * 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*
1752
1753 * Add an attribute reader method for ActiveRecord::Base.observers *Rick Olson*
1754
1755 * Deprecation: count class method should be called with an options hash rather than two args for conditions and joins. #6287 *Bob Silva*
1756
1757 * has_one associations with a nil target may be safely marshaled. #6279 *norbauer, Jeremy Kemper*
1758
1759 * Duplicate the hash provided to AR::Base#to_xml to prevent unexpected side effects *Michael Koziarski*
1760
1761 * Add a :namespace option to AR::Base#to_xml *Michael Koziarski*
1762
1763 * Deprecation tests. Remove warnings for dynamic finders and for the foo_count method if it's also an attribute. *Jeremy Kemper*
1764
1765 * Mock Time.now for more accurate Touch mixin tests. #6213 *Dan Peterson*
1766
1767 * Improve yaml fixtures error reporting. #6205 *Bruce Williams*
1768
1769 * Rename AR::Base#quote so people can use that name in their models. #3628 *Michael Koziarski*
1770
1771 * Add deprecation warning for inferred foreign key. #6029 *Josh Susser*
1772
1773 * 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*
1774
1775 * Deprecation: use :dependent => :delete_all rather than :exclusively_dependent => true. #6024 *Josh Susser*
1776
1777 * Document validates_presences_of behavior with booleans: you probably want validates_inclusion_of :attr, :in => [true, false]. #2253 *Bob Silva*
1778
1779 * Optimistic locking: gracefully handle nil versions, treat as zero. #5908 *Tom Ward*
1780
1781 * to_xml: the :methods option works on arrays of records. #5845 *Josh Starcher*
1782
1783 * Deprecation: update docs. #5998 *Jakob Skjerning, Kevin Clark*
1784
1785 * Add some XmlSerialization tests for ActiveRecord *Rick Olson*
1786
1787 * has_many :through conditions are sanitized by the associating class. #5971 *martin.emde@gmail.com*
1788
1789 * Tighten rescue clauses. #5985 *james@grayproductions.net*
1790
1791 * Fix spurious newlines and spaces in AR::Base#to_xml output *Jamis Buck*
1792
1793 * 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*
1794
1795 * Nested subclasses are not prefixed with the parent class' table_name since they should always use the base class' table_name. #5911 *Jonathan Viney*
1796
1797 * 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*
1798
1799 * SQLServer: fix eager association test. #5901 *Tom Ward*
1800
1801 * Clashing type columns due to a sloppy join shouldn't wreck single-table inheritance. #5838 *Kevin Clark*
1802
1803 * Fixtures: correct escaping of \n and \r. #5859 *evgeny.zislis@gmail.com*
1804
1805 * Migrations: gracefully handle missing migration files. #5857 *eli.gordon@gmail.com*
1806
1807 * MySQL: update test schema for MySQL 5 strict mode. #5861 *Tom Ward*
1808
1809 * to_xml: correct naming of included associations. #5831 *Josh Starcher*
1810
1811 * 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*
1812
1813 * 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*
1814
1815 # Create a tagging to associate the post and tag.
1816 post.tags << Tag.find_by_name('old')
1817 post.tags.create! :name => 'general'
1818
1819 # Would have been:
1820 post.taggings.create!(:tag => Tag.find_by_name('finally')
1821 transaction do
1822 post.taggings.create!(:tag => Tag.create!(:name => 'general'))
1823 end
1824
1825 * Cache nil results for :included has_one associations also. #5787 *Michael Schoen*
1826
1827 * 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*
1828
1829 * Nested classes are given table names prefixed by the singular form of the parent's table name. *Jeremy Kemper*
1830 Example: Invoice::Lineitem is given table name invoice_lineitems
1831
1832 * Migrations: uniquely name multicolumn indexes so you don't have to. *Jeremy Kemper*
1833 # people_active_last_name_index, people_active_deactivated_at_index
1834 add_index :people, [:active, :last_name]
1835 add_index :people, [:active, :deactivated_at]
1836 remove_index :people, [:active, :last_name]
1837 remove_index :people, [:active, :deactivated_at]
1838
1839 WARNING: backward-incompatibility. Multicolumn indexes created before this
1840 revision were named using the first column name only. Now they're uniquely
1841 named using all indexed columns.
1842
1843 To remove an old multicolumn index, remove_index :table_name, :first_column
1844
1845 * Fix for deep includes on the same association. *richcollins@gmail.com*
1846
1847 * Tweak fixtures so they don't try to use a non-ActiveRecord class. *Kevin Clark*
1848
1849 * Remove ActiveRecord::Base.reset since Dispatcher doesn't use it anymore. *Rick Olson*
1850
1851 * Document find's :from option. Closes #5762. *andrew@redlinesoftware.com*
1852
1853 * 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*
1854
1855 * Replace Reloadable with Reloadable::Deprecated. *Nicholas Seckar*
1856
1857 * Cache nil results for has_one associations so multiple calls don't call the database. Closes #5757. *Michael Schoen*
1858
1859 * Add documentation for how to disable timestamps on a per model basis. Closes #5684. *matt@mattmargolis.net Marcel Molina Jr.*
1860
1861 * Don't save has_one associations unnecessarily. #5735 *Jonathan Viney*
1862
1863 * Refactor ActiveRecord::Base.reset_subclasses to #reset, and add global observer resetting. *Rick Olson*
1864
1865 * Formally deprecate the deprecated finders. *Michael Koziarski*
1866
1867 * Formally deprecate rich associations. *Michael Koziarski*
1868
1869 * Fixed that default timezones for new / initialize should uphold utc setting #5709 *daniluk@yahoo.com*
1870
1871 * Fix announcement of very long migration names. #5722 *blake@near-time.com*
1872
1873 * The exists? class method should treat a string argument as an id rather than as conditions. #5698 *jeremy@planetargon.com*
1874
1875 * Fixed to_xml with :include misbehaviors when invoked on array of model instances #5690 *alexkwolfe@gmail.com*
1876
1877 * Added support for conditions on Base.exists? #5689 [Josh Peek]. Examples:
1878
1879 assert (Topic.exists?(:author_name => "David"))
1880 assert (Topic.exists?(:author_name => "Mary", :approved => true))
1881 assert (Topic.exists?(["parent_id = ?", 1]))
1882
1883 * Schema dumper quotes date :default values. *Dave Thomas*
1884
1885 * Calculate sum with SQL, not Enumerable on HasManyThrough Associations. *Dan Peterson*
1886
1887 * Factor the attribute#{suffix} methods out of method_missing for easier extension. *Jeremy Kemper*
1888
1889 * Patch sql injection vulnerability when using integer or float columns. *Jamis Buck*
1890
1891 * Allow #count through a has_many association to accept :include. *Dan Peterson*
1892
1893 * create_table rdoc: suggest :id => false for habtm join tables. *Zed Shaw*
1894
1895 * PostgreSQL: return array fields as strings. #4664 *Robby Russell*
1896
1897 * 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*
1898
1899 * SQLServer: fix db:schema:dump case-sensitivity. #4684 *Will Rogers*
1900
1901 * Oracle: BigDecimal support. #5667 *Michael Schoen*
1902
1903 * 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*
1904
1905 * Firebird migrations support. #5337 *Ken Kunz <kennethkunz@gmail.com>*
1906
1907 * PostgreSQL: create/drop as postgres user. #4790 *mail@matthewpainter.co.uk, mlaster@metavillage.com*
1908
1909 * Update callbacks documentation. #3970 *Robby Russell <robby@planetargon.com>*
1910
1911 * PostgreSQL: correctly quote the ' in pk_and_sequence_for. #5462 *tietew@tietew.net*
1912
1913 * PostgreSQL: correctly quote microseconds in timestamps. #5641 *rick@rickbradley.com*
1914
1915 * Clearer has_one/belongs_to model names (account has_one :user). #5632 *matt@mattmargolis.net*
1916
1917 * 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*
1918
1919 * 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*
1920
1921 * Added :group to available options for finds done on associations #5516 *mike@michaeldewey.org*
1922
1923 * Minor tweak to improve performance of ActiveRecord::Base#to_param.
1924
1925 * Observers also watch subclasses created after they are declared. #5535 *daniels@pronto.com.au*
1926
1927 * Removed deprecated timestamps_gmt class methods. *Jeremy Kemper*
1928
1929 * rake build_mysql_database grants permissions to rails@localhost. #5501 *brianegge@yahoo.com*
1930
1931 * PostgreSQL: support microsecond time resolution. #5492 *alex@msgpad.com*
1932
1933 * Add AssociationCollection#sum since the method_missing invokation has been shadowed by Enumerable#sum.
1934
1935 * Added find_or_initialize_by_X which works like find_or_create_by_X but doesn't save the newly instantiated record. *Sam Stephenson*
1936
1937 * 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*
1938 # Obtain an exclusive lock on person 1 so we can safely increment visits.
1939 Person.transaction do
1940 # select * from people where id=1 for update
1941 person = Person.find(1, :lock => true)
1942 person.visits += 1
1943 person.save!
1944 end
1945
1946 * 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*
1947
1948 * Use a per-thread (rather than global) transaction mutex so you may execute concurrent transactions on separate connections. *Jeremy Kemper*
1949
1950 * Change AR::Base#to_param to return a String instead of a Fixnum. Closes #5320. *Nicholas Seckar*
1951
1952 * Use explicit delegation instead of method aliasing for AR::Base.to_param -> AR::Base.id. #5299 (skaes@web.de)
1953
1954 * 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*
1955
1956 * Added simple hash conditions to find that'll just convert hash to an AND-based condition string #5143 [Hampton Catlin]. Example:
1957
1958 Person.find(:all, :conditions => { :last_name => "Catlin", :status => 1 }, :limit => 2)
1959
1960 ...is the same as:
1961
1962 Person.find(:all, :conditions => [ "last_name = ? and status = ?", "Catlin", 1 ], :limit => 2)
1963
1964 This makes it easier to pass in the options from a form or otherwise outside.
1965
1966
1967 * Fixed issues with BLOB limits, charsets, and booleans for Firebird #5194, #5191, #5189 *kennethkunz@gmail.com*
1968
1969 * Fixed usage of :limit and with_scope when the association in scope is a 1:m #5208 *alex@purefiction.net*
1970
1971 * Fixed migration trouble with SQLite when NOT NULL is used in the new definition #5215 *greg@lapcominc.com*
1972
1973 * Fixed problems with eager loading and counting on SQL Server #5212 *kajism@yahoo.com*
1974
1975 * Fixed that count distinct should use the selected column even when using :include #5251 *anna@wota.jp*
1976
1977 * 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*
1978
1979 * Allow models to override to_xml. #4989 *Blair Zajac <blair@orcaware.com>*
1980
1981 * PostgreSQL: don't ignore port when host is nil since it's often used to label the domain socket. #5247 *shimbo@is.naist.jp*
1982
1983 * Records and arrays of records are bound as quoted ids. *Jeremy Kemper*
1984 Foo.find(:all, :conditions => ['bar_id IN (?)', bars])
1985 Foo.find(:first, :conditions => ['bar_id = ?', bar])
1986
1987 * Fixed that Base.find :all, :conditions => [ "id IN (?)", collection ] would fail if collection was empty *David Heinemeier Hansson*
1988
1989 * Add a list of regexes assert_queries skips in the ActiveRecord test suite. *Rick Olson*
1990
1991 * Fix the has_and_belongs_to_many #create doesn't populate the join for new records. Closes #3692 *Josh Susser*
1992
1993 * Provide Association Extensions access to the instance that the association is being accessed from.
1994 Closes #4433 *Josh Susser*
1995
1996 * Update OpenBase adaterp's maintainer's email address. Closes #5176. *Derrick Spell*
1997
1998 * Add a quick note about :select and eagerly included associations. *Rick Olson*
1999
2000 * Add docs for the :as option in has_one associations. Closes #5144 *cdcarter@gmail.com*
2001
2002 * Fixed that has_many collections shouldn't load the entire association to do build or create *David Heinemeier Hansson*
2003
2004 * Added :allow_nil option for aggregations #5091 *Ian White*
2005
2006 * Fix Oracle boolean support and tests. Closes #5139. *Michael Schoen*
2007
2008 * 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*
2009
2010 * Call Inflector#demodulize on the class name when eagerly including an STI model. Closes #5077 *info@loobmedia.com*
2011
2012 * Preserve MySQL boolean column defaults when changing a column in a migration. Closes #5015. *pdcawley@bofh.org.uk*
2013
2014 * 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*
2015
2016 * Dates and times interpret empty strings as nil rather than 2000-01-01. #4830 *kajism@yahoo.com*
2017
2018 * Allow :uniq => true with has_many :through associations. *Jeremy Kemper*
2019
2020 * Ensure that StringIO is always available for the Schema dumper. *Marcel Molina Jr.*
2021
2022 * Allow AR::Base#to_xml to include methods too. Closes #4921. *johan@textdrive.com*
2023
2024 * Replace superfluous name_to_class_name variant with camelize. *Marcel Molina Jr.*
2025
2026 * Replace alias method chaining with Module#alias_method_chain. *Marcel Molina Jr.*
2027
2028 * Replace Ruby's deprecated append_features in favor of included. *Marcel Molina Jr.*
2029
2030 * Remove duplicate fixture entry in comments.yml. Closes #4923. *Blair Zajac <blair@orcaware.com>*
2031
2032 * Update FrontBase adapter to check binding version. Closes #4920. *mlaster@metavillage.com*
2033
2034 * New Frontbase connections don't start in auto-commit mode. Closes #4922. *mlaster@metavillage.com*
2035
2036 * When grouping, use the appropriate option key. *Marcel Molina Jr.*
2037
2038 * Only modify the sequence name in the FrontBase adapter if the FrontBase adapter is actually being used. *Marcel Molina Jr.*
2039
2040 * 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*
2041
2042 * Add warning about the proper way to validate the presence of a foreign key. Closes #4147. *Francois Beausoleil <francois.beausoleil@gmail.com>*
2043
2044 * Fix syntax error in documentation. Closes #4679. *Mislav Marohnić*
2045
2046 * Add Oracle support for CLOB inserts. Closes #4748. *schoenm@earthlink.net sandra.metz@duke.edu*
2047
2048 * Various fixes for sqlserver_adapter (odbc statement finishing, ado schema dumper, drop index). Closes #4831. *kajism@yahoo.com*
2049
2050 * Add support for :order option to with_scope. Closes #3887. *eric.daspet@survol.net*
2051
2052 * Prettify output of schema_dumper by making things line up. Closes #4241 *Caio Chassot <caio@v2studio.com>*
2053
2054 * Make build_postgresql_databases task make databases owned by the postgres user. Closes #4790. *mlaster@metavillage.com*
2055
2056 * Sybase Adapter type conversion cleanup. Closes #4736. *dev@metacasa.net*
2057
2058 * Fix bug where calculations with long alias names return null. *Rick Olson*
2059
2060 * Raise error when trying to add to a has_many :through association. Use the Join Model instead. *Rick Olson*
2061
2062 @post.tags << @tag # BAD
2063 @post.taggings.create(:tag => @tag) # GOOD
2064
2065 * Allow all calculations to take the :include option, not just COUNT (closes #4840) *Rick Olson*
2066
2067 * Update inconsistent migrations documentation. #4683 *machomagna@gmail.com*
2068
2069 * Add ActiveRecord::Errors#to_xml *Jamis Buck*
2070
2071 * Properly quote index names in migrations (closes #4764) *John Long*
2072
2073 * Fix the HasManyAssociation#count method so it uses the new ActiveRecord::Base#count syntax, while maintaining backwards compatibility. *Rick Olson*
2074
2075 * Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions *Rick Olson*
2076
2077 * Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. *Rick Olson*
2078
2079 * DRY up association collection reader method generation. *Marcel Molina Jr.*
2080
2081 * DRY up and tweak style of the validation error object. *Marcel Molina Jr.*
2082
2083 * Add :case_sensitive option to validates_uniqueness_of (closes #3090) *Rick Olson*
2084
2085 class Account < ActiveRecord::Base
2086 validates_uniqueness_of :email, :case_sensitive => false
2087 end
2088
2089 * Allow multiple association extensions with :extend option (closes #4666) *Josh Susser*
2090
2091 class Account < ActiveRecord::Base
2092 has_many :people, :extend => [FindOrCreateByNameExtension, FindRecentExtension]
2093 end
2094
2095 *1.15.3* (March 12th, 2007)
2096
2097 * Allow a polymorphic :source for has_many :through associations. Closes #7143 [protocool]
2098
2099 * Consistently quote primary key column names. #7763 [toolmantim]
2100
2101 * Fixtures: fix YAML ordered map support. #2665 [Manuel Holtgrewe, nfbuckley]
2102
2103 * Fix has_many :through << with custom foreign keys. #6466, #7153 [naffis, Rich Collins]
2104
2105
2106 ## 1.15.2 (February 5th, 2007) ##
2107
2108 * Pass a range in :conditions to use the SQL BETWEEN operator. #6974 *Dan Manges*
2109 Student.find(:all, :conditions => { :grade => 9..12 })
2110
2111 * Don't create instance writer methods for class attributes. *Rick Olson*
2112
2113 * 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*
2114
2115 * SQLServer: don't choke on strings containing 'null'. #7083 *Jakob Skjerning*
2116
2117 * 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*
2118
2119 * MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last inserted id. #6778 *Jonathan Viney, timc*
2120
2121 * Fixtures use the table name and connection from set_fixture_class. #7330 *Anthony Eden*
2122
2123 * SQLServer: quote table name in indexes query. #2928 *keithm@infused.org*
2124
2125
2126 ## 1.15.1 (January 17th, 2007) ##
2127
2128 * Fix nodoc breaking of adapters
2129
2130
2131 ## 1.15.0 (January 16th, 2007) ##
2132
2133 * [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name. #7072 *Jeremy McAnally*
2134
2135 * change_column accepts :default => nil. Skip column options for primary keys. #6956, #7048 *Dan Manges, Jeremy Kemper*
2136
2137 * 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*
2138
2139 * Oracle: create_table takes a :sequence_name option to override the 'tablename_seq' default. #7000 *Michael Schoen*
2140
2141 * MySQL: retain SSL settings on reconnect. #6976 *randyv2*
2142
2143 * SQLServer: handle [quoted] table names. #6635 *rrich*
2144
2145 * acts_as_nested_set works with single-table inheritance. #6030 *Josh Susser*
2146
2147 * PostgreSQL, Oracle: correctly perform eager finds with :limit and :order. #4668, #7021 *eventualbuddha, Michael Schoen*
2148
2149 * Fix the Oracle adapter for serialized attributes stored in CLOBs. Closes #6825 *mschoen, tdfowler*
2150
2151 * [DOCS] Apply more documentation for ActiveRecord Reflection. Closes #4055 *Robby Russell*
2152
2153 * [DOCS] Document :allow_nil option of #validate_uniqueness_of. Closes #3143 *Caio Chassot*
2154
2155 * Bring the sybase adapter up to scratch for 1.2 release. *jsheets*
2156
2157 * Oracle: fix connection reset failure. #6846 *leonlleslie*
2158
2159 * Subclass instantiation doesn't try to explicitly require the corresponding subclass. #6840 *leei, Jeremy Kemper*
2160
2161 * 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*
2162
2163 * find supports :lock with :include. Check whether your database allows SELECT ... FOR UPDATE with outer joins before using. #6764 *vitaly, Jeremy Kemper*
2164
2165 * Support nil and Array in :conditions => { attr => value } hashes. #6548 *Assaf, Jeremy Kemper*
2166 find(:all, :conditions => { :topic_id => [1, 2, 3], :last_read => nil }
2167
2168 * Quote ActiveSupport::Multibyte::Chars. #6653 *Julian Tarkhanov*
2169
2170 * 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*
2171
2172 * 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*
2173
2174 * Oracle: automatically detect the primary key. #6594 *vesaria, Michael Schoen*
2175
2176 * 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*
2177
2178 * Firebird: decimal/numeric support. #6408 *macrnic*
2179
2180 * Find with :include respects scoped :order. #5850
2181
2182 * Dynamically generate reader methods for serialized attributes. #6362 *Stefan Kaes*
2183
2184 * Deprecation: object transactions warning. *Jeremy Kemper*
2185
2186 * has_one :dependent => :nullify ignores nil associates. #6528 *janovetz, Jeremy Kemper*
2187
2188 * 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*
2189
2190 * Make add_column use the options hash with the Sqlite Adapter. Closes #6464 *obrie*
2191
2192 * Document other options available to migration's add_column. #6419 *grg*
2193
2194 * MySQL: all_hashes compatibility with old MysqlRes class. #6429, #6601 *Jeremy Kemper*
2195
2196 * Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes #5783. *Jonathan Viney*
2197
2198 * fix select_limited_ids_list issues in postgresql, retain current behavior in other adapters *Rick Olson*
2199
2200 * Restore eager condition interpolation, document it's differences *Rick Olson*
2201
2202 * 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*
2203
2204 * Add #delete support to has_many :through associations. Closes #6049 *Martin Landers*
2205
2206 * Reverted old select_limited_ids_list postgresql fix that caused issues in mysql. Closes #5851 *Rick Olson*
2207
2208 * 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*
2209
2210 * 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*
2211
2212 * Added update_attributes! which uses save! to raise an exception if a validation error prevents saving #6192 *jonathan*
2213
2214 * Deprecated add_on_boundary_breaking (use validates_length_of instead) #6292 *Bob Silva*
2215
2216 * The has_many create method works with polymorphic associations. #6361 *Dan Peterson*
2217
2218 * MySQL: introduce Mysql::Result#all_hashes to support further optimization. #5581 *Stefan Kaes*
2219
2220 * save! shouldn't validate twice. #6324 *maiha, Bob Silva*
2221
2222 * 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*
2223
2224 * Add an attribute reader method for ActiveRecord::Base.observers *Rick Olson*
2225
2226 * Deprecation: count class method should be called with an options hash rather than two args for conditions and joins. #6287 *Bob Silva*
2227
2228 * has_one associations with a nil target may be safely marshaled. #6279 *norbauer, Jeremy Kemper*
2229
2230 * Duplicate the hash provided to AR::Base#to_xml to prevent unexpected side effects *Michael Koziarski*
2231
2232 * Add a :namespace option to AR::Base#to_xml *Michael Koziarski*
2233
2234 * Deprecation tests. Remove warnings for dynamic finders and for the foo_count method if it's also an attribute. *Jeremy Kemper*
2235
2236 * Mock Time.now for more accurate Touch mixin tests. #6213 *Dan Peterson*
2237
2238 * Improve yaml fixtures error reporting. #6205 *Bruce Williams*
2239
2240 * Rename AR::Base#quote so people can use that name in their models. #3628 *Michael Koziarski*
2241
2242 * Add deprecation warning for inferred foreign key. #6029 *Josh Susser*
2243
2244 * 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*
2245
2246 * Deprecation: use :dependent => :delete_all rather than :exclusively_dependent => true. #6024 *Josh Susser*
2247
2248 * Optimistic locking: gracefully handle nil versions, treat as zero. #5908 *Tom Ward*
2249
2250 * to_xml: the :methods option works on arrays of records. #5845 *Josh Starcher*
2251
2252 * has_many :through conditions are sanitized by the associating class. #5971 *martin.emde@gmail.com*
2253
2254 * Fix spurious newlines and spaces in AR::Base#to_xml output *Jamis Buck*
2255
2256 * 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*
2257
2258 * Nested subclasses are not prefixed with the parent class' table_name since they should always use the base class' table_name. #5911 *Jonathan Viney*
2259
2260 * 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*
2261
2262 * Clashing type columns due to a sloppy join shouldn't wreck single-table inheritance. #5838 *Kevin Clark*
2263
2264 * Fixtures: correct escaping of \n and \r. #5859 *evgeny.zislis@gmail.com*
2265
2266 * Migrations: gracefully handle missing migration files. #5857 *eli.gordon@gmail.com*
2267
2268 * MySQL: update test schema for MySQL 5 strict mode. #5861 *Tom Ward*
2269
2270 * to_xml: correct naming of included associations. #5831 *Josh Starcher*
2271
2272 * 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*
2273
2274 * 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*
2275
2276 # Create a tagging to associate the post and tag.
2277 post.tags << Tag.find_by_name('old')
2278 post.tags.create! :name => 'general'
2279
2280 # Would have been:
2281 post.taggings.create!(:tag => Tag.find_by_name('finally')
2282 transaction do
2283 post.taggings.create!(:tag => Tag.create!(:name => 'general'))
2284 end
2285
2286 * Cache nil results for :included has_one associations also. #5787 *Michael Schoen*
2287
2288 * 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*
2289
2290 * Nested classes are given table names prefixed by the singular form of the parent's table name. *Jeremy Kemper*
2291 Example: Invoice::Lineitem is given table name invoice_lineitems
2292
2293 * Migrations: uniquely name multicolumn indexes so you don't have to. *Jeremy Kemper*
2294 # people_active_last_name_index, people_active_deactivated_at_index
2295 add_index :people, [:active, :last_name]
2296 add_index :people, [:active, :deactivated_at]
2297 remove_index :people, [:active, :last_name]
2298 remove_index :people, [:active, :deactivated_at]
2299
2300 WARNING: backward-incompatibility. Multicolumn indexes created before this
2301 revision were named using the first column name only. Now they're uniquely
2302 named using all indexed columns.
2303
2304 To remove an old multicolumn index, remove_index :table_name, :first_column
2305
2306 * Fix for deep includes on the same association. *richcollins@gmail.com*
2307
2308 * Tweak fixtures so they don't try to use a non-ActiveRecord class. *Kevin Clark*
2309
2310 * Remove ActiveRecord::Base.reset since Dispatcher doesn't use it anymore. *Rick Olson*
2311
2312 * 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*
2313
2314 * Replace Reloadable with Reloadable::Deprecated. *Nicholas Seckar*
2315
2316 * Cache nil results for has_one associations so multiple calls don't call the database. Closes #5757. *Michael Schoen*
2317
2318 * Don't save has_one associations unnecessarily. #5735 *Jonathan Viney*
2319
2320 * Refactor ActiveRecord::Base.reset_subclasses to #reset, and add global observer resetting. *Rick Olson*
2321
2322 * Formally deprecate the deprecated finders. *Michael Koziarski*
2323
2324 * Formally deprecate rich associations. *Michael Koziarski*
2325
2326 * Fixed that default timezones for new / initialize should uphold utc setting #5709 *daniluk@yahoo.com*
2327
2328 * Fix announcement of very long migration names. #5722 *blake@near-time.com*
2329
2330 * The exists? class method should treat a string argument as an id rather than as conditions. #5698 *jeremy@planetargon.com*
2331
2332 * Fixed to_xml with :include misbehaviors when invoked on array of model instances #5690 *alexkwolfe@gmail.com*
2333
2334 * Added support for conditions on Base.exists? #5689 [Josh Peek]. Examples:
2335
2336 assert (Topic.exists?(:author_name => "David"))
2337 assert (Topic.exists?(:author_name => "Mary", :approved => true))
2338 assert (Topic.exists?(["parent_id = ?", 1]))
2339
2340 * Schema dumper quotes date :default values. *Dave Thomas*
2341
2342 * Calculate sum with SQL, not Enumerable on HasManyThrough Associations. *Dan Peterson*
2343
2344 * Factor the attribute#{suffix} methods out of method_missing for easier extension. *Jeremy Kemper*
2345
2346 * Patch sql injection vulnerability when using integer or float columns. *Jamis Buck*
2347
2348 * Allow #count through a has_many association to accept :include. *Dan Peterson*
2349
2350 * create_table rdoc: suggest :id => false for habtm join tables. *Zed Shaw*
2351
2352 * PostgreSQL: return array fields as strings. #4664 *Robby Russell*
2353
2354 * 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*
2355
2356 * SQLServer: fix db:schema:dump case-sensitivity. #4684 *Will Rogers*
2357
2358 * Oracle: BigDecimal support. #5667 *Michael Schoen*
2359
2360 * 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*
2361
2362 * Firebird migrations support. #5337 *Ken Kunz <kennethkunz@gmail.com>*
2363
2364 * PostgreSQL: create/drop as postgres user. #4790 *mail@matthewpainter.co.uk, mlaster@metavillage.com*
2365
2366 * PostgreSQL: correctly quote the ' in pk_and_sequence_for. #5462 *tietew@tietew.net*
2367
2368 * PostgreSQL: correctly quote microseconds in timestamps. #5641 *rick@rickbradley.com*
2369
2370 * Clearer has_one/belongs_to model names (account has_one :user). #5632 *matt@mattmargolis.net*
2371
2372 * 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*
2373
2374 * 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*
2375
2376 * Added :group to available options for finds done on associations #5516 *mike@michaeldewey.org*
2377
2378 * Observers also watch subclasses created after they are declared. #5535 *daniels@pronto.com.au*
2379
2380 * Removed deprecated timestamps_gmt class methods. *Jeremy Kemper*
2381
2382 * rake build_mysql_database grants permissions to rails@localhost. #5501 *brianegge@yahoo.com*
2383
2384 * PostgreSQL: support microsecond time resolution. #5492 *alex@msgpad.com*
2385
2386 * Add AssociationCollection#sum since the method_missing invokation has been shadowed by Enumerable#sum.
2387
2388 * Added find_or_initialize_by_X which works like find_or_create_by_X but doesn't save the newly instantiated record. *Sam Stephenson*
2389
2390 * 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*
2391 # Obtain an exclusive lock on person 1 so we can safely increment visits.
2392 Person.transaction do
2393 # select * from people where id=1 for update
2394 person = Person.find(1, :lock => true)
2395 person.visits += 1
2396 person.save!
2397 end
2398
2399 * 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*
2400
2401 * Use a per-thread (rather than global) transaction mutex so you may execute concurrent transactions on separate connections. *Jeremy Kemper*
2402
2403 * Change AR::Base#to_param to return a String instead of a Fixnum. Closes #5320. *Nicholas Seckar*
2404
2405 * Use explicit delegation instead of method aliasing for AR::Base.to_param -> AR::Base.id. #5299 (skaes@web.de)
2406
2407 * 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*
2408
2409 * Added simple hash conditions to find that'll just convert hash to an AND-based condition string #5143 [Hampton Catlin]. Example:
2410
2411 Person.find(:all, :conditions => { :last_name => "Catlin", :status => 1 }, :limit => 2)
2412
2413 ...is the same as:
2414
2415 Person.find(:all, :conditions => [ "last_name = ? and status = ?", "Catlin", 1 ], :limit => 2)
2416
2417 This makes it easier to pass in the options from a form or otherwise outside.
2418
2419
2420 * Fixed issues with BLOB limits, charsets, and booleans for Firebird #5194, #5191, #5189 *kennethkunz@gmail.com*
2421
2422 * Fixed usage of :limit and with_scope when the association in scope is a 1:m #5208 *alex@purefiction.net*
2423
2424 * Fixed migration trouble with SQLite when NOT NULL is used in the new definition #5215 *greg@lapcominc.com*
2425
2426 * Fixed problems with eager loading and counting on SQL Server #5212 *kajism@yahoo.com*
2427
2428 * Fixed that count distinct should use the selected column even when using :include #5251 *anna@wota.jp*
2429
2430 * 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*
2431
2432 * Allow models to override to_xml. #4989 *Blair Zajac <blair@orcaware.com>*
2433
2434 * PostgreSQL: don't ignore port when host is nil since it's often used to label the domain socket. #5247 *shimbo@is.naist.jp*
2435
2436 * Records and arrays of records are bound as quoted ids. *Jeremy Kemper*
2437 Foo.find(:all, :conditions => ['bar_id IN (?)', bars])
2438 Foo.find(:first, :conditions => ['bar_id = ?', bar])
2439
2440 * Fixed that Base.find :all, :conditions => [ "id IN (?)", collection ] would fail if collection was empty *David Heinemeier Hansson*
2441
2442 * Add a list of regexes assert_queries skips in the ActiveRecord test suite. *Rick Olson*
2443
2444 * Fix the has_and_belongs_to_many #create doesn't populate the join for new records. Closes #3692 *Josh Susser*
2445
2446 * Provide Association Extensions access to the instance that the association is being accessed from.
2447 Closes #4433 *Josh Susser*
2448
2449 * Update OpenBase adaterp's maintainer's email address. Closes #5176. *Derrick Spell*
2450
2451 * Add a quick note about :select and eagerly included associations. *Rick Olson*
2452
2453 * Add docs for the :as option in has_one associations. Closes #5144 *cdcarter@gmail.com*
2454
2455 * Fixed that has_many collections shouldn't load the entire association to do build or create *David Heinemeier Hansson*
2456
2457 * Added :allow_nil option for aggregations #5091 *Ian White*
2458
2459 * Fix Oracle boolean support and tests. Closes #5139. *Michael Schoen*
2460
2461 * 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*
2462
2463 * Call Inflector#demodulize on the class name when eagerly including an STI model. Closes #5077 *info@loobmedia.com*
2464
2465 * Preserve MySQL boolean column defaults when changing a column in a migration. Closes #5015. *pdcawley@bofh.org.uk*
2466
2467 * 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*
2468
2469 * Dates and times interpret empty strings as nil rather than 2000-01-01. #4830 *kajism@yahoo.com*
2470
2471 * Allow :uniq => true with has_many :through associations. *Jeremy Kemper*
2472
2473 * Ensure that StringIO is always available for the Schema dumper. *Marcel Molina Jr.*
2474
2475 * Allow AR::Base#to_xml to include methods too. Closes #4921. *johan@textdrive.com*
2476
2477 * Remove duplicate fixture entry in comments.yml. Closes #4923. *Blair Zajac <blair@orcaware.com>*
2478
2479 * When grouping, use the appropriate option key. *Marcel Molina Jr.*
2480
2481 * 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*
2482
2483 * Add warning about the proper way to validate the presence of a foreign key. Closes #4147. *Francois Beausoleil <francois.beausoleil@gmail.com>*
2484
2485 * Fix syntax error in documentation. Closes #4679. *Mislav Marohnić*
2486
2487 * Add Oracle support for CLOB inserts. Closes #4748. *schoenm@earthlink.net sandra.metz@duke.edu*
2488
2489 * Various fixes for sqlserver_adapter (odbc statement finishing, ado schema dumper, drop index). Closes #4831. *kajism@yahoo.com*
2490
2491 * Add support for :order option to with_scope. Closes #3887. *eric.daspet@survol.net*
2492
2493 * Prettify output of schema_dumper by making things line up. Closes #4241 *Caio Chassot <caio@v2studio.com>*
2494
2495 * Make build_postgresql_databases task make databases owned by the postgres user. Closes #4790. *mlaster@metavillage.com*
2496
2497 * Sybase Adapter type conversion cleanup. Closes #4736. *dev@metacasa.net*
2498
2499 * Fix bug where calculations with long alias names return null. *Rick Olson*
2500
2501 * Raise error when trying to add to a has_many :through association. Use the Join Model instead. *Rick Olson*
2502
2503 @post.tags << @tag # BAD
2504 @post.taggings.create(:tag => @tag) # GOOD
2505
2506 * Allow all calculations to take the :include option, not just COUNT (closes #4840) *Rick Olson*
2507
2508 * Add ActiveRecord::Errors#to_xml *Jamis Buck*
2509
2510 * Properly quote index names in migrations (closes #4764) *John Long*
2511
2512 * Fix the HasManyAssociation#count method so it uses the new ActiveRecord::Base#count syntax, while maintaining backwards compatibility. *Rick Olson*
2513
2514 * Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions *Rick Olson*
2515
2516 * Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. *Rick Olson*
2517
2518 * Add :case_sensitive option to validates_uniqueness_of (closes #3090) *Rick Olson*
2519
2520 class Account < ActiveRecord::Base
2521 validates_uniqueness_of :email, :case_sensitive => false
2522 end
2523
2524 * Allow multiple association extensions with :extend option (closes #4666) *Josh Susser*
2525
2526 class Account < ActiveRecord::Base
2527 has_many :people, :extend => [FindOrCreateByNameExtension, FindRecentExtension]
2528 end
2529
2530
2531 ## 1.14.4 (August 8th, 2006) ##
2532
2533 * Add warning about the proper way to validate the presence of a foreign key. #4147 *Francois Beausoleil <francois.beausoleil@gmail.com>*
2534
2535 * Fix syntax error in documentation. #4679 *Mislav Marohnić*
2536
2537 * Update inconsistent migrations documentation. #4683 *machomagna@gmail.com*
2538
2539
2540 ## 1.14.3 (June 27th, 2006) ##
2541
2542 * Fix announcement of very long migration names. #5722 *blake@near-time.com*
2543
2544 * Update callbacks documentation. #3970 *Robby Russell <robby@planetargon.com>*
2545
2546 * Properly quote index names in migrations (closes #4764) *John Long*
2547
2548 * Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions *Rick Olson*
2549
2550 * Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. *Rick Olson*
2551
2552
2553 ## 1.14.2 (April 9th, 2006) ##
2554
2555 * Fixed calculations for the Oracle Adapter (closes #4626) *Michael Schoen*
2556
2557
2558 ## 1.14.1 (April 6th, 2006) ##
2559
2560 * Fix type_name_with_module to handle type names that begin with '::'. Closes #4614. *Nicholas Seckar*
2561
2562 * Fixed that that multiparameter assignment doesn't work with aggregations (closes #4620) *Lars Pind*
2563
2564 * Enable Limit/Offset in Calculations (closes #4558) *lmarlow*
2565
2566 * Fixed that loading including associations returns all results if Load IDs For Limited Eager Loading returns none (closes #4528) *Rick Olson*
2567
2568 * Fixed HasManyAssociation#find bugs when :finder_sql is set #4600 *lagroue@free.fr*
2569
2570 * Allow AR::Base#respond_to? to behave when @attributes is nil *Ryan Davis*
2571
2572 * Support eager includes when going through a polymorphic has_many association. *Rick Olson*
2573
2574 * Added support for eagerly including polymorphic has_one associations. (closes #4525) *Rick Olson*
2575
2576 class Post < ActiveRecord::Base
2577 has_one :tagging, :as => :taggable
2578 end
2579
2580 Post.find :all, :include => :tagging
2581
2582 * Added descriptive error messages for invalid has_many :through associations: going through :has_one or :has_and_belongs_to_many *Rick Olson*
2583
2584 * Added support for going through a polymorphic has_many association: (closes #4401) *Rick Olson*
2585
2586 class PhotoCollection < ActiveRecord::Base
2587 has_many :photos, :as => :photographic
2588 belongs_to :firm
2589 end
2590
2591 class Firm < ActiveRecord::Base
2592 has_many :photo_collections
2593 has_many :photos, :through => :photo_collections
2594 end
2595
2596 * Multiple fixes and optimizations in PostgreSQL adapter, allowing ruby-postgres gem to work properly. *ruben.nine@gmail.com*
2597
2598 * Fixed that AssociationCollection#delete_all should work even if the records of the association are not loaded yet. *Florian Weber*
2599
2600 * Changed those private ActiveRecord methods to take optional third argument :auto instead of nil for performance optimizations. (closes #4456) *Stefan*
2601
2602 * Private ActiveRecord methods add_limit!, add_joins!, and add_conditions! take an OPTIONAL third argument 'scope' (closes #4456) *Rick Olson*
2603
2604 * DEPRECATED: Using additional attributes on has_and_belongs_to_many associations. Instead upgrade your association to be a real join model *David Heinemeier Hansson*
2605
2606 * 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*
2607
2608 * 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.*
2609
2610 * Fixed broken OCIAdapter #4457 *Michael Schoen*
2611
2612
2613 ## 1.14.0 (March 27th, 2006) ##
2614
2615 * Replace 'rescue Object' with a finer grained rescue. Closes #4431. *Nicholas Seckar*
2616
2617 * Fixed eager loading so that an aliased table cannot clash with a has_and_belongs_to_many join table *Rick Olson*
2618
2619 * Add support for :include to with_scope *andrew@redlinesoftware.com*
2620
2621 * Support the use of public synonyms with the Oracle adapter; required ruby-oci8 v0.1.14 #4390 *Michael Schoen*
2622
2623 * Change periods (.) in table aliases to _'s. Closes #4251 *jeff@ministrycentered.com*
2624
2625 * Changed has_and_belongs_to_many join to INNER JOIN for Mysql 3.23.x. Closes #4348 *Rick Olson*
2626
2627 * Fixed issue that kept :select options from being scoped *Rick Olson*
2628
2629 * Fixed db_schema_import when binary types are present #3101 *David Heinemeier Hansson*
2630
2631 * Fixed that MySQL enums should always be returned as strings #3501 *David Heinemeier Hansson*
2632
2633 * Change has_many :through to use the :source option to specify the source association. :class_name is now ignored. *Rick Olson*
2634
2635 class Connection < ActiveRecord::Base
2636 belongs_to :user
2637 belongs_to :channel
2638 end
2639
2640 class Channel < ActiveRecord::Base
2641 has_many :connections
2642 has_many :contacts, :through => :connections, :class_name => 'User' # OLD
2643 has_many :contacts, :through => :connections, :source => :user # NEW
2644 end
2645
2646 * 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*
2647
2648 * Allow overriding of find parameters in scoped has_many :through calls *Rick Olson*
2649
2650 In this example, :include => false disables the default eager association from loading. :select changes the standard
2651 select clause. :joins specifies a join that is added to the end of the has_many :through query.
2652
2653 class Post < ActiveRecord::Base
2654 has_many :tags, :through => :taggings, :include => :tagging do
2655 def add_joins_and_select
2656 find :all, :select => 'tags.*, authors.id as author_id', :include => false,
2657 :joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id'
2658 end
2659 end
2660 end
2661
2662 * Fixed that schema changes while the database was open would break any connections to an SQLite database (now we reconnect if that error is throw) *David Heinemeier Hansson*
2663
2664 * Don't classify the has_one class when eager loading, it is already singular. Add tests. (closes #4117) *Jonathan Viney*
2665
2666 * Quit ignoring default :include options in has_many :through calls *Mark James*
2667
2668 * Allow has_many :through associations to find the source association by setting a custom class (closes #4307) *Jonathan Viney*
2669
2670 * Eager Loading support added for has_many :through => :has_many associations (see below). *Rick Olson*
2671
2672 * Allow has_many :through to work on has_many associations (closes #3864) [sco@scottraymond.net] Example:
2673
2674 class Firm < ActiveRecord::Base
2675 has_many :clients
2676 has_many :invoices, :through => :clients
2677 end
2678
2679 class Client < ActiveRecord::Base
2680 belongs_to :firm
2681 has_many :invoices
2682 end
2683
2684 class Invoice < ActiveRecord::Base
2685 belongs_to :client
2686 end
2687
2688 * Raise error when trying to select many polymorphic objects with has_many :through or :include (closes #4226) *Josh Susser*
2689
2690 * Fixed has_many :through to include :conditions set on the :through association. closes #4020 *Jonathan Viney*
2691
2692 * 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*
2693
2694 * SQL Server adapter gets some love #4298 *Ryan Tomayko*