Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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