Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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