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