Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/tags/rel_0-14-4/activerecord/CHANGELOG

Revision 3250, 101.6 kB (checked in by david, 3 years ago)

Prepare versions for release

Line 
1 *1.13.1* (December 7th, 2005)
2
3 * MySQL: more robust test for nullified result hashes.  #3124 [Stefan Kaes]
4
5 * SQLite: find database file when RAILS_ROOT is a symlink.  #3116 [anna@wota.jp]
6
7 * Reloading an instance refreshes its aggregations as well as its associations.  #3024 [François Beausolei]
8
9 * Fixed that using :include together with :conditions array in Base.find would cause NoMethodError #2887 [Paul Hammmond]
10
11 * PostgreSQL: more robust sequence name discovery.  #3087 [Rick Olson]
12
13 * Oracle: use syntax compatible with Oracle 8.  #3131 [Michael Schoen]
14
15 * MySQL: work around ruby-mysql/mysql-ruby inconsistency with mysql.stat.  Eliminate usage of mysql.ping because it doesn't guarantee reconnect.  Explicitly close and reopen the connection instead.  [Jeremy Kemper]
16
17 * When AbstractAdapter#log rescues an exception, attempt to detect and reconnect to an inactive database connection.  Connection adapter must respond to the active? and reconnect! instance methods.  Initial support for PostgreSQL, MySQL, and SQLite.  Make certain that all statements which may need reconnection are performed within a logged block: for example, this means no avoiding log(sql, name) { } if @logger.nil?  [Jeremy Kemper]
18
19 * Firebird: active? and reconnect! methods for handling stale connections.  #428 [Ken Kunz <kennethkunz@gmail.com>]
20
21 * Firebird: updated for FireRuby 0.4.0.  #3009 [Ken Kunz <kennethkunz@gmail.com>]
22
23 * Introducing the Firebird adapter.  Quote columns and use attribute_condition more consistently.  Setup guide: http://wiki.rubyonrails.com/rails/pages/Firebird+Adapter  #1874 [Ken Kunz <kennethkunz@gmail.com>]
24
25 * MySQL and PostgreSQL: active? compatibility with the pure-Ruby driver.  #428 [Jeremy Kemper]
26
27 * Oracle: active? check pings the database rather than testing the last command status.  #428 [Michael Schoen]
28
29 * SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find.  #2974 [kajism@yahoo.com]
30
31 * Reloading a model doesn't lose track of its connection.  #2996 [junk@miriamtech.com, Jeremy Kemper]
32
33 * Fixed bug where using update_attribute after pushing a record to a habtm association of the object caused duplicate rows in the join table. #2888 [colman@rominato.com, Florian Weber, Michael Schoen]
34
35 * MySQL: introduce :encoding option to specify the character set for client, connection, and results.  Only available for MySQL 4.1 and later with the mysql-ruby driver.  Do SHOW CHARACTER SET in mysql client to see available encodings.  #2975 [Shugo Maeda]
36
37 * Add tasks to create, drop and rebuild the MySQL and PostgreSQL test  databases. [Marcel Molina Jr.]
38
39 * Correct boolean handling in generated reader methods.  #2945 [don.park@gmail.com, Stefan Kaes]
40
41 * Don't generate read methods for columns whose names are not valid ruby method names.  #2946 [Stefan Kaes]
42
43 * Document :force option to create_table.  #2921 [Blair Zajac <blair@orcaware.com>]
44
45 * Don't add the same conditions twice in has_one finder sql.  #2916 [Jeremy Evans]
46
47 * Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
48
49 * SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY.  #2866 [kajism@yahoo.com, Tom Ward <tom@popdog.net>]
50
51 * Correct documentation for Base.delete_all.  #1568 [Newhydra]
52
53 * Oracle: test case for column default parsing.  #2788 [Michael Schoen <schoenm@earthlink.net>]
54
55 * Update documentation for Migrations.  #2861 [Tom Werner <tom@cube6media.com>]
56
57 * Oracle: Much faster column reflection.  #2848 [Michael Schoen <schoenm@earthlink.net>]
58
59 * Base.reset_sequence_name analogous to reset_table_name (mostly useful for testing).  Base.define_attr_method allows nil values.  [Jeremy Kemper]
60
61 * PostgreSQL: smarter sequence name defaults, stricter last_insert_id, warn on pk without sequence.  [Jeremy Kemper]
62
63 * PostgreSQL: correctly discover custom primary key sequences.  #2594 [Blair Zajac <blair@orcaware.com>, meadow.nnick@gmail.com, Jeremy Kemper]
64
65 * SQLServer: don't report limits for unsupported field types.  #2835 [Ryan Tomayko]
66
67 * Include the Enumerable module in ActiveRecord::Errors.  [Rick Bradley <rick@rickbradley.com>]
68
69 * Add :group option, correspond to GROUP BY, to the find method and to the has_many association.  #2818 [rubyonrails@atyp.de]
70
71 * Don't cast nil or empty strings to a dummy date.  #2789 [Rick Bradley <rick@rickbradley.com>]
72
73 * acts_as_list plays nicely with inheritance by remembering the class which declared it.  #2811 [rephorm@rephorm.com]
74
75 * Fix sqlite adaptor's detection of missing dbfile or database declaration. [Nicholas Seckar]
76
77 * Fixed acts_as_list for definitions without an explicit :order #2803 [jonathan@bluewire.net.nz]
78
79 * Upgrade bundled ruby-mysql 0.2.4 with mysql411 shim (see #440) to ruby-mysql 0.2.6 with a patchset for 4.1 protocol support.  Local change [301] is now a part of the main driver; reapplied local change [2182].  Removed GC.start from Result.free.  [tommy@tmtm.org, akuroda@gmail.com, Doug Fales <doug.fales@gmail.com>, Jeremy Kemper]
80
81 * Correct handling of complex order clauses with SQL Server limit emulation.  #2770 [Tom Ward <tom@popdog.net>, Matt B.]
82
83 * Correct whitespace problem in Oracle default column value parsing.  #2788 [rick@rickbradley.com]
84
85 * Destroy associated has_and_belongs_to_many records after all before_destroy callbacks but before destroy.  This allows you to act on the habtm association as you please while preserving referential integrity.  #2065 [larrywilliams1@gmail.com, sam.kirchmeier@gmail.com, elliot@townx.org, Jeremy Kemper]
86
87 * Deprecate the old, confusing :exclusively_dependent option in favor of :dependent => :delete_all.  [Jeremy Kemper]
88
89 * More compatible Oracle column reflection.  #2771 [Ryan Davis <ryand-ruby@zenspider.com>, Michael Schoen <schoenm@earthlink.net>]
90
91
92 *1.13.0* (November 7th, 2005)
93
94 * Fixed faulty regex in get_table_name method (SQLServerAdapter) #2639 [Ryan Tomayko]
95
96 * Added :include as an option for association declarations [DHH]. Example:
97
98     has_many :posts, :include => [ :author, :comments ]
99
100 * Rename Base.constrain to Base.with_scope so it doesn't conflict with existing concept of database constraints.  Make scoping more robust: uniform method => parameters, validated method names and supported finder parameters, raise exception on nested scopes.  [Jeremy Kemper]  Example:
101
102     Comment.with_scope(:find => { :conditions => 'active=true' }, :create => { :post_id => 5 }) do
103       # Find where name = ? and active=true
104       Comment.find :all, :conditions => ['name = ?', name]
105       # Create comment associated with :post_id
106       Comment.create :body => "Hello world"
107     end
108
109 * Fixed that SQL Server should ignore :size declarations on anything but integer and string in the agnostic schema representation #2756 [Ryan Tomayko]
110
111 * Added constrain scoping for creates using a hash of attributes bound to the :creation key [DHH]. Example:
112
113     Comment.constrain(:creation => { :post_id => 5 }) do
114       # Associated with :post_id
115       Comment.create :body => "Hello world"
116     end
117  
118   This is rarely used directly, but allows for find_or_create on associations. So you can do:
119  
120     # If the tag doesn't exist, a new one is created that's associated with the person
121     person.tags.find_or_create_by_name("Summer")
122
123 * Added find_or_create_by_X as a second type of dynamic finder that'll create the record if it doesn't already exist [DHH]. Example:
124
125     # No 'Summer' tag exists
126     Tag.find_or_create_by_name("Summer") # equal to Tag.create(:name => "Summer")
127    
128     # Now the 'Summer' tag does exist
129     Tag.find_or_create_by_name("Summer") # equal to Tag.find_by_name("Summer")
130
131 * Added extension capabilities to has_many and has_and_belongs_to_many proxies [DHH]. Example:
132
133     class Account < ActiveRecord::Base
134       has_many :people do
135         def find_or_create_by_name(name)
136           first_name, *last_name = name.split
137           last_name = last_name.join " "
138
139           find_or_create_by_first_name_and_last_name(first_name, last_name)
140         end
141       end
142     end
143
144     person = Account.find(:first).people.find_or_create_by_name("David Heinemeier Hansson")
145     person.first_name # => "David"
146     person.last_name  # => "Heinemeier Hansson"
147
148   Note that the anoymous module must be declared using brackets, not do/end (due to order of evaluation).
149
150 * Omit internal dtproperties table from SQLServer table list.  #2729 [rtomayko@gmail.com]
151
152 * Quote column names in generated SQL.  #2728 [rtomayko@gmail.com]
153
154 * Correct the pure-Ruby MySQL 4.1.1 shim's version test.  #2718 [Jeremy Kemper]
155
156 * Add Model.create! to match existing model.save! method.  When save! raises RecordInvalid, you can catch the exception, retrieve the invalid record (invalid_exception.record), and see its errors (invalid_exception.record.errors).  [Jeremy Kemper]
157
158 * Correct fixture behavior when table name pluralization is off.  #2719 [Rick Bradley <rick@rickbradley.com>]
159
160 * Changed :dbfile to :database for SQLite adapter for consistency (old key still works as an alias) #2644 [Dan Peterson]
161
162 * Added migration support for Oracle #2647 [Michael Schoen]
163
164 * Worked around that connection can't be reset if allow_concurrency is off.  #2648 [Michael Schoen <schoenm@earthlink.net>]
165
166 * Fixed SQL Server adapter to pass even more tests and do even better #2634 [rtomayko@gmail.com]
167
168 * Fixed SQL Server adapter so it honors options[:conditions] when applying :limits #1978 [Tom Ward]
169
170 * Added migration support to SQL Server adapter (please someone do the same for Oracle and DB2) #2625 [Tom Ward]
171
172 * Use AR::Base.silence rather than AR::Base.logger.silence in fixtures to preserve Log4r compatibility.  #2618 [dansketcher@gmail.com]
173
174 * Constraints are cloned so they can't be inadvertently modified while they're
175 in effect.  Added :readonly finder constraint.  Calling an association collection's class method (Part.foobar via item.parts.foobar) constrains :readonly => false since the collection's :joins constraint would otherwise force it to true.  [Jeremy Kemper <rails@bitsweat.net>]
176
177 * Added :offset and :limit to the kinds of options that Base.constrain can use #2466 [duane.johnson@gmail.com]
178
179 * Fixed handling of nil number columns on Oracle and cleaned up tests for Oracle in general #2555 [schoenm@earthlink.net]
180
181 * Added quoted_true and quoted_false methods and tables to db2_adapter and cleaned up tests for DB2 #2493, #2624 [maik schmidt]
182
183
184 *1.12.2* (October 26th, 2005)
185
186 * Allow symbols to rename columns when using SQLite adapter. #2531 [kevin.clark@gmail.com]
187
188 * Map Active Record time to SQL TIME.  #2575, #2576 [Robby Russell <robby@planetargon.com>]
189
190 * Clarify semantics of ActiveRecord::Base#respond_to?  #2560 [skaes@web.de]
191
192 * Fixed Association#clear for associations which have not yet been accessed. #2524 [Patrick Lenz <patrick@lenz.sh>]
193
194 * HABTM finders shouldn't return readonly records.  #2525 [Patrick Lenz <patrick@lenz.sh>]
195
196 * Make all tests runnable on their own. #2521. [Blair Zajac <blair@orcaware.com>]
197
198
199 *1.12.1* (October 19th, 2005)
200
201 * Always parenthesize :conditions options so they may be safely combined with STI and constraints.
202
203 * Correct PostgreSQL primary key sequence detection.  #2507 [tmornini@infomania.com]
204
205 * Added support for using limits in eager loads that involve has_many and has_and_belongs_to_many associations
206
207
208 *1.12.0* (October 16th, 2005)
209
210 * Update/clean up documentation (rdoc)
211
212 * PostgreSQL sequence support.  Use set_sequence_name in your model class to specify its primary key sequence.  #2292 [Rick Olson <technoweenie@gmail.com>, Robby Russell <robby@planetargon.com>]
213
214 * Change default logging colors to work on both white and black backgrounds. [Sam Stephenson]
215
216 * YAML fixtures support ordered hashes for fixtures with foreign key dependencies in the same table.  #1896 [purestorm@ggnore.net]
217
218 * :dependent now accepts :nullify option. Sets the foreign key of the related objects to NULL instead of deleting them. #2015 [Robby Russell <robby@planetargon.com>]
219
220 * Introduce read-only records.  If you call object.readonly! then it will mark the object as read-only and raise ReadOnlyRecord if you call object.save.  object.readonly? reports whether the object is read-only.  Passing :readonly => true to any finder method will mark returned records as read-only.  The :joins option now implies :readonly, so if you use this option, saving the same record will now fail.  Use find_by_sql to work around.
221
222 * Avoid memleak in dev mode when using fcgi
223
224 * Simplified .clear on active record associations by using the existing delete_records method. #1906 [Caleb <me@cpb.ca>]
225
226 * Delegate access to a customized primary key to the conventional id method. #2444. [Blair Zajac <blair@orcaware.com>]
227
228 * Fix errors caused by assigning a has-one or belongs-to property to itself
229
230 * Add ActiveRecord::Base.schema_format setting which specifies how databases should be dumped [Sam Stephenson]
231
232 * Update DB2 adapter. #2206. [contact@maik-schmidt.de]
233
234 * Corrections to SQLServer native data types. #2267.  [rails.20.clarry@spamgourmet.com]
235
236 * Deprecated ActiveRecord::Base.threaded_connection in favor of ActiveRecord::Base.allow_concurrency.
237
238 * Protect id attribute from mass assigment even when the primary key is set to something else. #2438. [Blair Zajac <blair@orcaware.com>]
239
240 * Misc doc fixes (typos/grammar/etc.). #2430. [coffee2code]
241
242 * Add test coverage for content_columns. #2432. [coffee2code]
243
244 * Speed up for unthreaded environments. #2431. [skaes@web.de]
245
246 * Optimization for Mysql selects using mysql-ruby extension greater than 2.6.3.  #2426. [skaes@web.de]
247
248 * Speed up the setting of table_name. #2428. [skaes@web.de]
249
250 * Optimize instantiation of STI subclass records. In partial fullfilment of #1236. [skaes@web.de]
251
252 * Fix typo of 'constrains' to 'contraints'. #2069. [Michael Schuerig <michael@schuerig.de>]
253
254 * Optimization refactoring for add_limit_offset!. In partial fullfilment of #1236. [skaes@web.de]
255
256 * Add ability to get all siblings, including the current child, with acts_as_tree. Recloses #2140. [Michael Schuerig <michael@schuerig.de>]
257
258 * Add geometric type for postgresql adapter. #2233 [akaspick@gmail.com]
259
260 * Add option (true by default) to generate reader methods for each attribute of a record to avoid the overhead of calling method missing. In partial fullfilment of #1236. [skaes@web.de]
261
262 * Add convenience predicate methods on Column class. In partial fullfilment of #1236. [skaes@web.de]
263
264 * Raise errors when invalid hash keys are passed to ActiveRecord::Base.find. #2363  [Chad Fowler <chad@chadfowler.com>, Nicholas Seckar]
265
266 * Added :force option to create_table that'll try to drop the table if it already exists before creating
267
268 * Fix transactions so that calling return while inside a transaction will not leave an open transaction on the connection. [Nicholas Seckar]
269
270 * Use foreign_key inflection uniformly.  #2156 [Blair Zajac <blair@orcaware.com>]
271
272 * model.association.clear should destroy associated objects if :dependent => true instead of nullifying their foreign keys.  #2221 [joergd@pobox.com, ObieFernandez <obiefernandez@gmail.com>]
273
274 * Returning false from before_destroy should cancel the action.  #1829 [Jeremy Huffman]
275
276 * Recognize PostgreSQL NOW() default as equivalent to CURRENT_TIMESTAMP or CURRENT_DATE, depending on the column's type.  #2256 [mat <mat@absolight.fr>]
277
278 * Extensive documentation for the abstract database adapter.  #2250 [François Beausoleil <fbeausoleil@ftml.net>]
279
280 * Clean up Fixtures.reset_sequences for PostgreSQL.  Handle tables with no rows and models with custom primary keys.  #2174, #2183 [jay@jay.fm, Blair Zajac <blair@orcaware.com>]
281
282 * Improve error message when nil is assigned to an attr which validates_size_of within a range.  #2022 [Manuel Holtgrewe <purestorm@ggnore.net>]
283
284 * Make update_attribute use the same writer method that update_attributes uses.
285  #2237 [trevor@protocool.com]
286
287 * Make migrations honor table name prefixes and suffixes. #2298 [Jakob S, Marcel Molina]
288
289 * Correct and optimize PostgreSQL bytea escaping.  #1745, #1837 [dave@cherryville.org, ken@miriamtech.com, bellis@deepthought.org]
290
291 * Fixtures should only reset a PostgreSQL sequence if it corresponds to an integer primary key named id.  #1749 [chris@chrisbrinker.com]
292
293 * Standardize the interpretation of boolean columns in the Mysql and Sqlite adapters. (Use MysqlAdapter.emulate_booleans = false to disable this behavior)
294
295 * Added new symbol-driven approach to activating observers with Base#observers= [DHH]. Example:
296
297     ActiveRecord::Base.observers = :cacher, :garbage_collector
298
299 * Added AbstractAdapter#select_value and AbstractAdapter#select_values as convenience methods for selecting single values, instead of hashes, of the first column in a SELECT #2283 [solo@gatelys.com]
300
301 * Wrap :conditions in parentheses to prevent problems with OR's #1871 [Jamis Buck]
302
303 * Allow the postgresql adapter to work with the SchemaDumper. [Jamis Buck]
304
305 * Add ActiveRecord::SchemaDumper for dumping a DB schema to a pure-ruby file, making it easier to consolidate large migration lists and port database schemas between databases. [Jamis Buck]
306
307 * Fixed migrations for Windows when using more than 10 [David Naseby]
308
309 * Fixed that the create_x method from belongs_to wouldn't save the association properly #2042 [Florian Weber]
310
311 * Fixed saving a record with two unsaved belongs_to associations pointing to the same object #2023 [Tobias Luetke]
312
313 * Improved migrations' behavior when the schema_info table is empty. [Nicholas Seckar]
314
315 * Fixed that Observers didn't observe sub-classes #627 [Florian Weber]
316
317 * Fix eager loading error messages, allow :include to specify tables using strings or symbols. Closes #2222 [Marcel Molina]
318
319 * Added check for RAILS_CONNECTION_ADAPTERS on startup and only load the connection adapters specified within if its present (available in Rails through config.connection_adapters using the new config) #1958 [skae]
320
321 * Fixed various problems with has_and_belongs_to_many when using customer finder_sql #2094 [Florian Weber]
322
323 * Added better exception error when unknown column types are used with migrations #1814 [fbeausoleil@ftml.net]
324
325 * Fixed "connection lost" issue with the bundled Ruby/MySQL driver (would kill the app after 8 hours of inactivity) #2163, #428 [kajism@yahoo.com]
326
327 * Fixed comparison of Active Record objects so two new objects are not equal #2099 [deberg]
328
329 * Fixed that the SQL Server adapter would sometimes return DBI::Timestamp objects instead of Time #2127 [Tom Ward]
330
331 * Added the instance methods #root and #ancestors on acts_as_tree and fixed siblings to not include the current node #2142, #2140 [coffee2code]
332
333 * Fixed that Active Record would call SHOW FIELDS twice (or more) for the same model when the cached results were available #1947 [sd@notso.net]
334
335 * Added log_level and use_silence parameter to ActiveRecord::Base.benchmark. The first controls at what level the benchmark statement will be logged (now as debug, instead of info) and the second that can be passed false to include all logging statements during the benchmark block/
336
337 * Make sure the schema_info table is created before querying the current version #1903
338
339 * Fixtures ignore table name prefix and suffix #1987 [Jakob S]
340
341 * Add documentation for index_type argument to add_index method for migrations #2005 [blaine@odeo.com]
342
343 * Modify read_attribute to allow a symbol argument #2024 [Ken Kunz]
344
345 * Make destroy return self #1913 [sebastian.kanthak@muehlheim.de]
346
347 * Fix typo in validations documentation #1938 [court3nay]
348
349 * Make acts_as_list work for insert_at(1) #1966 [hensleyl@papermountain.org]
350
351 * Fix typo in count_by_sql documentation #1969 [Alexey Verkhovsky]
352
353 * Allow add_column and create_table to specify NOT NULL #1712 [emptysands@gmail.com]
354
355 * Fix create_table so that id column is implicitly added [Rick Olson]
356
357 * Default sequence names for Oracle changed to #{table_name}_seq, which is the most commonly used standard. In addition, a new method ActiveRecord::Base#set_sequence_name allows the developer to set the sequence name per model. This is a non-backwards-compatible change -- anyone using the old-style "rails_sequence" will need to either create new sequences, or set: ActiveRecord::Base.set_sequence_name = "rails_sequence" #1798
358
359 * OCIAdapter now properly handles synonyms, which are commonly used to separate out the schema owner from the application user #1798
360
361 * Fixed the handling of camelCase columns names in Oracle #1798
362
363 * Implemented for OCI the Rakefile tasks of :clone_structure_to_test, :db_structure_dump, and :purge_test_database, which enable Oracle folks to enjoy all the agile goodness of Rails for testing. Note that the current implementation is fairly limited -- only tables and sequences are cloned, not constraints or indexes. A full clone in Oracle generally requires some manual effort, and is version-specific. Post 9i, Oracle recommends the use of the DBMS_METADATA package, though that approach requires editing of the physical characteristics generated #1798
364
365 * Fixed the handling of multiple blob columns in Oracle if one or more of them are null #1798
366
367 * Added support for calling constrained class methods on has_many and has_and_belongs_to_many collections #1764 [Tobias Luetke]
368
369     class Comment < AR:B
370       def self.search(q)
371         find(:all, :conditions => ["body = ?", q])
372       end
373     end
374
375     class Post < AR:B
376       has_many :comments
377     end
378
379     Post.find(1).comments.search('hi') # => SELECT * from comments WHERE post_id = 1 AND body = 'hi'
380  
381   NOTICE: This patch changes the underlying SQL generated by has_and_belongs_to_many queries. If your relying on that, such as
382   by explicitly referencing the old t and j aliases, you'll need to update your code. Of course, you _shouldn't_ be relying on
383   details like that no less than you should be diving in to touch private variables. But just in case you do, consider yourself
384   noticed :)
385
386 * Added migration support for SQLite (using temporary tables to simulate ALTER TABLE) #1771 [Sam Stephenson]
387
388 * Remove extra definition of supports_migrations? from abstract_adaptor.rb [Nicholas Seckar]
389
390 * Fix acts_as_list so that moving next-to-last item to the bottom does not result in duplicate item positions
391
392 * Fixed incompatibility in DB2 adapter with the new limit/offset approach #1718 [Maik Schmidt]
393
394 * Added :select option to find which can specify a different value than the default *, like find(:all, :select => "first_name, last_name"), if you either only want to select part of the columns or exclude columns otherwise included from a join #1338 [Stefan Kaes]
395
396
397 *1.11.1* (11 July, 2005)
398
399 * Added support for limit and offset with eager loading of has_one and belongs_to associations. Using the options with has_many and has_and_belongs_to_many associations will now raise an ActiveRecord::ConfigurationError #1692 [Rick Olsen]
400
401 * Fixed that assume_bottom_position (in acts_as_list) could be called on items already last in the list and they would move one position away from the list #1648 [tyler@kianta.com]
402
403 * Added ActiveRecord::Base.threaded_connections flag to turn off 1-connection per thread (required for thread safety). By default it's on, but WEBrick in Rails need it off #1685 [Sam Stephenson]
404
405 * Correct reflected table name for singular associations.  #1688 [court3nay@gmail.com]
406
407 * Fixed optimistic locking with SQL Server #1660 [tom@popdog.net]
408
409 * Added ActiveRecord::Migrator.migrate that can figure out whether to go up or down based on the target version and the current
410
411 * Added better error message for "packets out of order" #1630 [courtenay]
412
413 * Fixed first run of "rake migrate" on PostgreSQL by not expecting a return value on the id #1640
414
415
416 *1.11.0* (6 July, 2005)
417
418 * Fixed that Yaml error message in fixtures hid the real error #1623 [Nicholas Seckar]
419
420 * Changed logging of SQL statements to use the DEBUG level instead of INFO
421
422 * Added new Migrations framework for describing schema transformations in a way that can be easily applied across multiple databases #1604 [Tobias Luetke] See documentation under ActiveRecord::Migration and the additional support in the Rails rakefile/generator.
423
424 * Added callback hooks to association collections #1549 [Florian Weber]. Example:
425
426     class Project
427       has_and_belongs_to_many :developers, :before_add => :evaluate_velocity
428    
429       def evaluate_velocity(developer)
430         ...
431       end
432     end
433  
434   ..raising an exception will cause the object not to be added (or removed, with before_remove).
435    
436
437 * Fixed Base.content_columns call for SQL Server adapter #1450 [DeLynn Berry]
438
439 * Fixed Base#write_attribute to work with both symbols and strings #1190 [Paul Legato]
440
441 * Fixed that has_and_belongs_to_many didn't respect single table inheritance types #1081 [Florian Weber]
442
443 * Speed up ActiveRecord#method_missing for the common case (read_attribute).
444
445 * Only notify observers on after_find and after_initialize if these methods are defined on the model.  #1235 [skaes@web.de]
446
447 * Fixed that single-table inheritance sub-classes couldn't be used to limit the result set with eager loading #1215 [Chris McGrath]
448
449 * Fixed validates_numericality_of to work with overrided getter-method when :allow_nil is on #1316 [raidel@onemail.at]
450
451 * Added roots, root, and siblings to the batch of methods added by acts_as_tree #1541 [michael@schuerig.de]
452
453 * Added support for limit/offset with the MS SQL Server driver so that pagination will now work #1569 [DeLynn Berry]
454
455 * Added support for ODBC connections to MS SQL Server so you can connect from a non-Windows machine #1569 [Mark Imbriaco/DeLynn Berry]
456
457 * Fixed that multiparameter posts ignored attr_protected #1532 [alec+rails@veryclever.net]
458
459 * Fixed problem with eager loading when using a has_and_belongs_to_many association using :association_foreign_key #1504 [flash@vanklinkenbergsoftware.nl]
460
461 * Fixed Base#find to honor the documentation on how :joins work and make them consistent with Base#count #1405 [pritchie@gmail.com]. What used to be:
462
463     Developer.find :all, :joins => 'developers_projects', :conditions => 'id=developer_id AND project_id=1'
464  
465   ...should instead be:
466  
467     Developer.find(
468       :all,
469       :joins => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id',
470       :conditions => 'project_id=1'
471     )   
472
473 * Fixed that validations didn't respecting custom setting for too_short, too_long messages #1437 [Marcel Molina]
474
475 * Fixed that clear_association_cache doesn't delete new associations on new records (so you can safely place new records in the session with Action Pack without having new associations wiped) #1494 [cluon]
476
477 * Fixed that calling Model.find([]) returns [] and doesn't throw an exception #1379
478
479 * Fixed that adding a record to a has_and_belongs_to collection would always save it -- now it only saves if its a new record #1203 [Alisdair McDiarmid]
480
481 * Fixed saving of in-memory association structures to happen as a after_create/after_update callback instead of after_save -- that way you can add new associations in after_create/after_update callbacks without getting them saved twice
482
483 * Allow any Enumerable, not just Array, to work as bind variables #1344 [Jeremy Kemper]
484
485 * Added actual database-changing behavior to collection assigment for has_many and has_and_belongs_to_many #1425 [Sebastian Kanthak].
486   Example:
487
488     david.projects = [Project.find(1), Project.new("name" => "ActionWebSearch")]
489     david.save
490  
491   If david.projects already contain the project with ID 1, this is left unchanged. Any other projects are dropped. And the new
492   project is saved when david.save is called.
493  
494   Also included is a way to do assignments through IDs, which is perfect for checkbox updating, so you get to do:
495  
496     david.project_ids = [1, 5, 7]
497
498 * Corrected typo in find SQL for has_and_belongs_to_many.  #1312 [ben@bensinclair.com]
499
500 * Fixed sanitized conditions for has_many finder method.  #1281 [jackc@hylesanderson.com, pragdave, Tobias Luetke]
501
502 * Comprehensive PostgreSQL schema support.  Use the optional schema_search_path directive in database.yml to give a comma-separated list of schemas to search for your tables.  This allows you, for example, to have tables in a shared schema without having to use a custom table name.  See http://www.postgresql.org/docs/8.0/interactive/ddl-schemas.html to learn more.  #827 [dave@cherryville.org]
503
504 * Corrected @@configurations typo #1410 [david@ruppconsulting.com]
505
506 * Return PostgreSQL columns in the order they were declared #1374 [perlguy@gmail.com]
507
508 * Allow before/after update hooks to work on models using optimistic locking
509
510 * Eager loading of dependent has_one associations won't delete the association #1212
511
512 * Added a second parameter to the build and create method for has_one that controls whether the existing association should be replaced (which means nullifying its foreign key as well). By default this is true, but false can be passed to prevent it.
513
514 * Using transactional fixtures now causes the data to be loaded only once.
515
516 * Added fixture accessor methods that can be used when instantiated fixtures are disabled.
517
518     fixtures :web_sites
519
520     def test_something
521       assert_equal "Ruby on Rails", web_sites(:rubyonrails).name
522     end
523
524 * Added DoubleRenderError exception that'll be raised if render* is called twice #518 [Nicholas Seckar]
525
526 * Fixed exceptions occuring after render has been called #1096 [Nicholas Seckar]
527
528 * CHANGED: validates_presence_of now uses Errors#add_on_blank, which will make "  " fail the validation where it didn't before #1309
529
530 * Added Errors#add_on_blank which works like Errors#add_on_empty, but uses Object#blank? instead
531
532 * Added the :if option to all validations that can either use a block or a method pointer to determine whether the validation should be run or not. #1324 [Duane Johnson/jhosteny]. Examples:
533
534   Conditional validations such as the following are made possible:
535     validates_numericality_of :income, :if => :employed?
536
537   Conditional validations can also solve the salted login generator problem:
538     validates_confirmation_of :password, :if => :new_password?
539  
540   Using blocks:
541     validates_presence_of :username, :if => Proc.new { |user| user.signup_step > 1 }
542
543 * Fixed use of construct_finder_sql when using :join #1288 [dwlt@dwlt.net]
544
545 * Fixed that :delete_sql in has_and_belongs_to_many associations couldn't access record properties #1299 [Rick Olson]
546
547 * Fixed that clone would break when an aggregate had the same name as one of its attributes #1307 [Jeremy Kemper]
548
549 * Changed that destroying an object will only freeze the attributes hash, which keeps the object from having attributes changed (as that wouldn't make sense), but allows for the querying of associations after it has been destroyed.
550
551 * Changed the callbacks such that observers are notified before the in-object callbacks are triggered. Without this change, it wasn't possible to act on the whole object in something like a before_destroy observer without having the objects own callbacks (like deleting associations) called first.
552
553 * Added option for passing an array to the find_all version of the dynamic finders and have it evaluated as an IN fragment. Example:
554
555     # SELECT * FROM topics WHERE title IN ('First', 'Second')
556     Topic.find_all_by_title(["First", "Second"])
557
558 * Added compatibility with camelCase column names for dynamic finders #533 [Dee.Zsombor]
559
560 * Fixed extraneous comma in count() function that made it not work with joins #1156 [jarkko/Dee.Zsombor]
561
562 * Fixed incompatibility with Base#find with an array of ids that would fail when using eager loading #1186 [Alisdair McDiarmid]
563
564 * Fixed that validate_length_of lost :on option when :within was specified #1195 [jhosteny@mac.com]
565
566 * Added encoding and min_messages options for PostgreSQL #1205 [shugo]. Configuration example:
567
568     development:
569       adapter: postgresql
570       database: rails_development
571       host: localhost
572       username: postgres
573       password:
574       encoding: UTF8
575       min_messages: ERROR
576
577 * Fixed acts_as_list where deleting an item that was removed from the list would ruin the positioning of other list items #1197 [Jamis Buck]
578
579 * Added validates_exclusion_of as a negative of validates_inclusion_of
580
581 * Optimized counting of has_many associations by setting the association to empty if the count is 0 so repeated calls doesn't trigger database calls
582
583
584 *1.10.1* (20th April, 2005)
585
586 * Fixed frivilous database queries being triggered with eager loading on empty associations and other things
587
588 * Fixed order of loading in eager associations
589
590 * Fixed stray comma when using eager loading and ordering together from has_many associations #1143
591
592
593 *1.10.0* (19th April, 2005)
594
595 * Added eager loading of associations as a way to solve the N+1 problem more gracefully without piggy-back queries. Example:
596
597     for post in Post.find(:all, :limit => 100)
598       puts "Post:            " + post.title
599       puts "Written by:      " + post.author.name
600       puts "Last comment on: " + post.comments.first.created_on
601     end
602  
603   This used to generate 301 database queries if all 100 posts had both author and comments. It can now be written as:
604  
605     for post in Post.find(:all, :limit => 100, :include => [ :author, :comments ])
606  
607   ...and the number of database queries needed is now 1.
608
609 * Added new unified Base.find API and deprecated the use of find_first and find_all. See the documentation for Base.find. Examples:
610
611     Person.find(1, :conditions => "administrator = 1", :order => "created_on DESC")
612     Person.find(1, 5, 6, :conditions => "administrator = 1", :order => "created_on DESC")
613     Person.find(:first, :order => "created_on DESC", :offset => 5)
614     Person.find(:all, :conditions => [ "category IN (?)", categories], :limit => 50)
615     Person.find(:all, :offset => 10, :limit => 10)
616
617 * Added acts_as_nested_set #1000 [wschenk]. Introduction:
618
619     This acts provides Nested Set functionality.  Nested Set is similiar to Tree, but with
620     the added feature that you can select the children and all of it's descendants with
621     a single query.  A good use case for this is a threaded post system, where you want
622     to display every reply to a comment without multiple selects.
623
624 * Added Base.save! that attempts to save the record just like Base.save but will raise a RecordInvalid exception instead of returning false if the record is not valid [After much pestering from Dave Thomas]
625
626 * Fixed PostgreSQL usage of fixtures with regards to public schemas and table names with dots #962 [gnuman1@gmail.com]
627
628 * Fixed that fixtures were being deleted in the same order as inserts causing FK errors #890 [andrew.john.peters@gmail.com]
629
630 * Fixed loading of fixtures in to be in the right order (or PostgreSQL would bark) #1047 [stephenh@chase3000.com]
631
632 * Fixed page caching for non-vhost applications living underneath the root #1004 [Ben Schumacher]
633
634 * Fixes a problem with the SQL Adapter which was resulting in IDENTITY_INSERT not being set to ON when it should be #1104 [adelle]
635
636 * Added the option to specify the acceptance string in validates_acceptance_of #1106 [caleb@aei-tech.com]
637
638 * Added insert_at(position) to acts_as_list #1083 [DeLynnB]
639
640 * Removed the default order by id on has_and_belongs_to_many queries as it could kill performance on large sets (you can still specify by hand with :order)
641
642 * Fixed that Base.silence should restore the old logger level when done, not just set it to DEBUG #1084 [yon@milliped.com]
643
644 * Fixed boolean saving on Oracle #1093 [mparrish@pearware.org]
645
646 * Moved build_association and create_association for has_one and belongs_to out of deprecation as they work when the association is nil unlike association.build and association.create, which require the association to be already in place #864
647
648 * Added rollbacks of transactions if they're active as the dispatcher is killed gracefully (TERM signal) #1054 [Leon Bredt]
649
650 * Added quoting of column names for fixtures #997 [jcfischer@gmail.com]
651
652 * Fixed counter_sql when no records exist in database for PostgreSQL (would give error, not 0) #1039 [Caleb Tennis]
653
654 * Fixed that benchmarking times for rendering included db runtimes #987 [skaes@web.de]
655
656 * Fixed boolean queries for t/f fields in PostgreSQL #995 [dave@cherryville.org]
657
658 * Added that model.items.delete(child) will delete the child, not just set the foreign key to nil, if the child is dependent on the model #978 [Jeremy Kemper]
659
660 * Fixed auto-stamping of dates (created_on/updated_on) for PostgreSQL #985 [dave@cherryville.org]
661
662 * Fixed Base.silence/benchmark to only log if a logger has been configured #986 [skaes@web.de]
663
664 * Added a join parameter as the third argument to Base.find_first and as the second to Base.count #426, #988 [skaes@web.de]
665
666 * Fixed bug in Base#hash method that would treat records with the same string-based id as different [Dave Thomas]
667
668 * Renamed DateHelper#distance_of_time_in_words_to_now to DateHelper#time_ago_in_words (old method name is still available as a deprecated alias)
669
670
671 *1.9.1* (27th March, 2005)
672
673 * Fixed that Active Record objects with float attribute could not be cloned #808
674
675 * Fixed that MissingSourceFile's wasn't properly detected in production mode #925 [Nicholas Seckar]
676
677 * Fixed that :counter_cache option would look for a line_items_count column for a LineItem object instead of lineitems_count
678
679 * Fixed that AR exists?() would explode on postgresql if the passed id did not match the PK type #900 [Scott Barron]
680
681 * Fixed the MS SQL adapter to work with the new limit/offset approach and with binary data (still suffering from 7KB limit, though) #901 [delynnb]
682
683
684 *1.9.0* (22th March, 2005)
685
686 * Added adapter independent limit clause as a two-element array with the first being the limit, the second being the offset #795 [Sam Stephenson]. Example:
687
688     Developer.find_all nil, 'id ASC', 5      # return the first five developers
689     Developer.find_all nil, 'id ASC', [3, 8] # return three developers, starting from #8 and forward
690    
691   This doesn't yet work with the DB2 or MS SQL adapters. Patches to make that happen are encouraged.
692
693 * Added alias_method :to_param, :id to Base, such that Active Record objects to be used as URL parameters in Action Pack automatically #812 [Nicholas Seckar/Sam Stephenson]
694
695 * Improved the performance of the OCI8 adapter for Oracle #723 [pilx/gjenkins]
696
697 * Added type conversion before saving a record, so string-based values like "10.0" aren't left for the database to convert #820 [dave@cherryville.org]
698
699 * Added with additional settings for working with transactional fixtures and pre-loaded test databases #865 [mindel]
700
701 * Fixed acts_as_list to trigger remove_from_list on destroy after the fact, not before, so a unique position can be maintained #871 [Alisdair McDiarmid]
702
703 * Added the possibility of specifying fixtures in multiple calls #816 [kim@tinker.com]
704
705 * Added Base.exists?(id) that'll return true if an object of the class with the given id exists #854 [stian@grytoyr.net]
706
707 * Added optionally allow for nil or empty strings with validates_numericality_of #801 [Sebastian Kanthak]
708
709 * Fixed problem with using slashes in validates_format_of regular expressions #801 [Sebastian Kanthak]
710
711 * Fixed that SQLite3 exceptions are caught and reported properly #823 [yerejm]
712
713 * Added that all types of after_find/after_initialized callbacks are triggered if the explicit implementation is present, not only the explicit implementation itself
714
715 * Fixed that symbols can be used on attribute assignment, like page.emails.create(:subject => data.subject, :body => data.body)
716
717
718 *1.8.0* (7th March, 2005)
719
720 * Added ActiveRecord::Base.colorize_logging to control whether to use colors in logs or not (on by default)
721
722 * Added support for timestamp with time zone in PostgreSQL #560 [Scott Barron]
723
724 * Added MultiparameterAssignmentErrors and AttributeAssignmentError exceptions #777 [demetrius]. Documentation:
725
726    * +MultiparameterAssignmentErrors+ -- collection of errors that occurred during a mass assignment using the
727      +attributes=+ method. The +errors+ property of this exception contains an array of +AttributeAssignmentError+
728      objects that should be inspected to determine which attributes triggered the errors.
729    * +AttributeAssignmentError+ -- an error occurred while doing a mass assignment through the +attributes=+ method.
730      You can inspect the +attribute+ property of the exception object to determine which attribute triggered the error.
731
732 * Fixed that postgresql adapter would fails when reading bytea fields with null value #771 [rodrigo k]
733
734 * Added transactional fixtures that uses rollback to undo changes to fixtures instead of DELETE/INSERT -- it's much faster. See documentation under Fixtures #760 [Jeremy Kemper]
735
736 * Added destruction of dependent objects in has_one associations when a new assignment happens #742 [mindel]. Example:
737
738     class Account < ActiveRecord::Base
739       has_one :credit_card, :dependent => true
740     end
741     class CreditCard < ActiveRecord::Base
742       belongs_to :account
743     end
744
745     account.credit_card # => returns existing credit card, lets say id = 12
746     account.credit_card = CreditCard.create("number" => "123")
747     account.save # => CC with id = 12 is destroyed
748
749
750 * Added validates_numericality_of #716 [skanthak/c.r.mcgrath]. Docuemntation:
751
752     Validates whether the value of the specified attribute is numeric by trying to convert it to
753     a float with Kernel.Float (if <tt>integer</tt> is false) or applying it to the regular expression
754     <tt>/^[\+\-]?\d+$/</tt> (if <tt>integer</tt> is set to true).
755    
756       class Person < ActiveRecord::Base
757         validates_numericality_of :value, :on => :create
758       end
759    
760     Configuration options:
761     * <tt>message</tt> - A custom error message (default is: "is not a number")
762     * <tt>on</tt> Specifies when this validation is active (default is :save, other options :create, :update)
763     * <tt>only_integer</tt> Specifies whether the value has to be an integer, e.g. an integral value (default is false)
764    
765
766 * Fixed that HasManyAssociation#count was using :finder_sql rather than :counter_sql if it was available #445 [Scott Barron]
767
768 * Added better defaults for composed_of, so statements like composed_of :time_zone, :mapping => %w( time_zone time_zone ) can be written without the mapping part (it's now assumed)
769
770 * Added MacroReflection#macro which will return a symbol describing the macro used (like :composed_of or :has_many) #718, #248 [james@slashetc.com]
771
772
773 *1.7.0* (24th February, 2005)
774
775 * Changed the auto-timestamping feature to use ActiveRecord::Base.default_timezone instead of entertaining the parallel ActiveRecord::Base.timestamps_gmt method. The latter is now deprecated and will throw a warning on use (but still work) #710 [Jamis Buck]
776
777 * Added a OCI8-based Oracle adapter that has been verified to work with Oracle 8 and 9 #629 [Graham Jenkins]. Usage notes:
778
779     1.  Key generation uses a sequence "rails_sequence" for all tables. (I couldn't find a simple
780         and safe way of passing table-specific sequence information to the adapter.)
781     2.  Oracle uses DATE or TIMESTAMP datatypes for both dates and times. Consequently I have had to
782         resort to some hacks to get data converted to Date or Time in Ruby.
783         If the column_name ends in _at (like created_at, updated_at) it's created as a Ruby Time. Else if the
784         hours/minutes/seconds are 0, I make it a Ruby Date. Else it's a Ruby Time.
785         This is nasty - but if you use Duck Typing you'll probably not care very much.
786         In 9i it's tempting to map DATE to Date and TIMESTAMP to Time but I don't think that is
787         valid - too many databases use DATE for both.
788         Timezones and sub-second precision on timestamps are not supported.
789     3.  Default values that are functions (such as "SYSDATE") are not supported. This is a
790         restriction of the way active record supports default values.
791     4.  Referential integrity constraints are not fully supported. Under at least
792         some circumstances, active record appears to delete parent and child records out of
793         sequence and out of transaction scope. (Or this may just be a problem of test setup.)
794
795   The OCI8 driver can be retrieved from http://rubyforge.org/projects/ruby-oci8/
796
797 * Added option :schema_order to the PostgreSQL adapter to support the use of multiple schemas per database #697 [YuriSchimke]
798
799 * Optimized the SQL used to generate has_and_belongs_to_many queries by listing the join table first #693 [yerejm]
800
801 * Fixed that when using validation macros with a custom message, if you happened to use single quotes in the message string you would get a parsing error #657 [tonka]
802
803 * Fixed that Active Record would throw Broken Pipe errors with FCGI when the MySQL connection timed out instead of reconnecting #428 [Nicholas Seckar]
804
805 * Added options to specify an SSL connection for MySQL. Define the following attributes in the connection config (config/database.yml in Rails) to use it: sslkey, sslcert, sslca, sslcapath, sslcipher. To use SSL with no client certs, just set :sslca = '/dev/null'. http://dev.mysql.com/doc/mysql/en/secure-connections.html #604 [daniel@nightrunner.com]
806
807 * Added automatic dropping/creating of test tables for running the unit tests on all databases #587 [adelle@bullet.net.au]
808
809 * Fixed that find_by_* would fail when column names had numbers #670 [demetrius]
810
811 * Fixed the SQL Server adapter on a bunch of issues #667 [DeLynn]
812
813     1. Created a new columns method that is much cleaner.
814     2. Corrected a problem with the select and select_all methods
815        that didn't account for the LIMIT clause being passed into raw SQL statements.
816     3. Implemented the string_to_time method in order to create proper instances of the time class.
817     4. Added logic to the simplified_type method that allows the database to specify the scale of float data.
818     5. Adjusted the quote_column_name to account for the fact that MS SQL is bothered by a forward slash in the data string.
819
820 * Fixed that the dynamic finder like find_all_by_something_boolean(false) didn't work #649 [lmarlow@yahoo.com]
821
822 * Added validates_each that validates each specified attribute against a block #610 [Jeremy Kemper]. Example:
823    
824     class Person < ActiveRecord::Base
825       validates_each :first_name, :last_name do |record, attr|
826         record.errors.add attr, 'starts with z.' if attr[0] == ?z
827       end
828     end
829
830 * Added :allow_nil as an explicit option for validates_length_of, so unless that's set to true having the attribute as nil will also return an error if a range is specified as :within #610 [Jeremy Kemper]
831
832 * Added that validates_* now accept blocks to perform validations #618 [Tim Bates]. Example:
833
834     class Person < ActiveRecord::Base
835       validate { |person| person.errors.add("title", "will never be valid") if SHOULD_NEVER_BE_VALID }
836     end
837
838 * Addded validation for validate all the associated objects before declaring failure with validates_associated #618 [Tim Bates]
839
840 * Added keyword-style approach to defining the custom relational bindings #545 [Jamis Buck]. Example:
841
842     class Project < ActiveRecord::Base
843       primary_key "sysid"
844       table_name "XYZ_PROJECT"
845       inheritance_column { original_inheritance_column + "_id" }
846     end
847
848 * Fixed Base#clone for use with PostgreSQL #565 [hanson@surgery.wisc.edu]
849
850
851 *1.6.0* (January 25th, 2005)
852
853 * Added that has_many association build and create methods can take arrays of record data like Base#create and Base#build to build/create multiple records at once.
854
855 * Added that Base#delete and Base#destroy both can take an array of ids to delete/destroy #336
856
857 * Added the option of supplying an array of attributes to Base#create, so that multiple records can be created at once.
858
859 * Added the option of supplying an array of ids and attributes to Base#update, so that multiple records can be updated at once (inspired by #526/Duane Johnson). Example
860
861     people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy"} }
862     Person.update(people.keys, people.values)
863
864 * Added ActiveRecord::Base.timestamps_gmt that can be set to true to make the automated timestamping use GMT instead of local time #520 [Scott Baron]
865
866 * Added that update_all calls sanitize_sql on its updates argument, so stuff like MyRecord.update_all(['time = ?', Time.now]) works #519 [notahat]
867
868 * Fixed that the dynamic finders didn't treat nil as a "IS NULL" but rather "= NULL" case #515 [Demetrius]
869
870 * Added bind-named arrays for interpolating a group of ids or strings in conditions #528 [Jeremy Kemper]
871
872 * Added that has_and_belongs_to_many associations with additional attributes also can be created between unsaved objects and only committed to the database when Base#save is called on the associator #524 [Eric Anderson]
873
874 * Fixed that records fetched with piggy-back attributes or through rich has_and_belongs_to_many associations couldn't be saved due to the extra attributes not part of the table #522 [Eric Anderson]
875
876 * Added mass-assignment protection for the inheritance column -- regardless of a custom column is used or not
877
878 * Fixed that association proxies would fail === tests like PremiumSubscription === @account.subscription
879
880 * Fixed that column aliases didn't work as expected with the new MySql411 driver #507 [Demetrius]
881
882 * Fixed that find_all would produce invalid sql when called sequentialy #490 [Scott Baron]
883
884
885 *1.5.1* (January 18th, 2005)
886
887 * Fixed that the belongs_to and has_one proxy would fail a test like 'if project.manager' -- this unfortunately also means that you can't call methods like project.manager.build unless there already is a manager on the project #492 [Tim Bates]
888
889 * Fixed that the Ruby/MySQL adapter wouldn't connect if the password was empty #503 [Pelle]
890
891
892 *1.5.0* (January 17th, 2005)
893
894 * Fixed that unit tests for MySQL are now run as the "rails" user instead of root #455 [Eric Hodel]
895
896 * Added validates_associated that enables validation of objects in an unsaved association #398 [Tim Bates]. Example:
897
898     class Book < ActiveRecord::Base
899       has_many :pages
900       belongs_to :library
901    
902       validates_associated :pages, :library
903     end
904    
905 * Added support for associating unsaved objects #402 [Tim Bates]. Rules that govern this addition:
906
907     == Unsaved objects and associations
908    
909     You can manipulate objects and associations before they are saved to the database, but there is some special behaviour you should be
910     aware of, mostly involving the saving of associated objects.
911    
912     === One-to-one associations
913    
914     * Assigning an object to a has_one association automatically saves that object, and the object being replaced (if there is one), in
915       order to update their primary keys - except if the parent object is unsaved (new_record? == true).
916     * If either of these saves fail (due to one of the objects being invalid) the assignment statement returns false and the assignment
917       is cancelled.
918     * If you wish to assign an object to a has_one association without saving it, use the #association.build method (documented below).
919     * Assigning an object to a belongs_to association does not save the object, since the foreign key field belongs on the parent. It does
920       not save the parent either.
921    
922     === Collections
923    
924     * Adding an object to a collection (has_many or has_and_belongs_to_many) automatically saves that object, except if the parent object
925       (the owner of the collection) is not yet stored in the database.
926     * If saving any of the objects being added to a collection (via #push or similar) fails, then #push returns false.
927     * You can add an object to a collection without automatically saving it by using the #collection.build method (documented below).
928     * All unsaved (new_record? == true) members of the collection are automatically saved when the parent is saved.
929
930 * Added replace to associations, so you can do project.manager.replace(new_manager) or project.milestones.replace(new_milestones) #402 [Tim Bates]
931
932 * Added build and create methods to has_one and belongs_to associations, so you can now do project.manager.build(attributes) #402 [Tim Bates]
933
934 * Added that if a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last. #402 [Tim Bates]
935
936 * Fixed that Base#== wouldn't work for multiple references to the same unsaved object #402 [Tim Bates]
937
938 * Fixed binary support for PostgreSQL #444 [alex@byzantine.no]
939
940 * Added a differenciation between AssociationCollection#size and -length. Now AssociationCollection#size returns the size of the
941   collection by executing a SELECT COUNT(*) query if the collection hasn't been loaded and calling collection.size if it has. If
942   it's more likely than not that the collection does have a size larger than zero and you need to fetch that collection afterwards,
943   it'll take one less SELECT query if you use length.
944
945 * Added Base#attributes that returns a hash of all the attributes with their names as keys and clones of their objects as values #433 [atyp.de]
946
947 * Fixed that foreign keys named the same as the association would cause stack overflow #437 [Eric Anderson]
948
949 * Fixed default scope of acts_as_list from "1" to "1 = 1", so it'll work in PostgreSQL (among other places) #427 [Alexey]
950
951 * Added Base#reload that reloads the attributes of an object from the database #422 [Andreas Schwarz]
952
953 * Added SQLite3 compatibility through the sqlite3-ruby adapter by Jamis Buck #381 [Jeremy Kemper]
954
955 * Added support for the new protocol spoken by MySQL 4.1.1+ servers for the Ruby/MySQL adapter that ships with Rails #440 [Matt Mower]
956
957 * Added that Observers can use the observes class method instead of overwriting self.observed_class().
958
959     Before:
960       class ListSweeper < ActiveRecord::Base
961         def self.observed_class() [ List, Item ]
962       end
963    
964     After:
965       class ListSweeper < ActiveRecord::Base
966         observes List, Item
967       end
968
969 * Fixed that conditions in has_many and has_and_belongs_to_many should be interpolated just like the finder_sql is
970
971 * Fixed Base#update_attribute to be indifferent to whether a string or symbol is used to describe the name
972
973 * Added Base#toggle(attribute) and Base#toggle!(attribute) that makes it easier to flip a switch or flag.
974
975     Before: topic.update_attribute(:approved, !approved?)
976     After : topic.toggle!(:approved)
977
978 * Added Base#increment!(attribute) and Base#decrement!(attribute) that also saves the records. Example:
979
980     page.views # => 1
981     page.increment!(:views) # executes an UPDATE statement
982     page.views # => 2
983    
984     page.increment(:views).increment!(:views)
985     page.views # => 4
986
987 * Added Base#increment(attribute) and Base#decrement(attribute) that encapsulates the += 1 and -= 1 patterns.
988
989
990 *1.4.0* (January 4th, 2005)
991
992 * Added automated optimistic locking if the field <tt>lock_version</tt> is present.  Each update to the
993   record increments the lock_version column and the locking facilities ensure that records instantiated twice
994   will let the last one saved raise a StaleObjectError if the first was also updated. Example:
995  
996     p1 = Person.find(1)
997     p2 = Person.find(1)
998    
999     p1.first_name = "Michael"
1000     p1.save
1001    
1002     p2.first_name = "should fail"
1003     p2.save # Raises a ActiveRecord::StaleObjectError
1004  
1005   You're then responsible for dealing with the conflict by rescuing the exception and either rolling back, merging,
1006   or otherwise apply the business logic needed to resolve the conflict.
1007
1008   #384 [Michael Koziarski]
1009
1010 * Added dynamic attribute-based finders as a cleaner way of getting objects by simple queries without turning to SQL.
1011   They work by appending the name of an attribute to <tt>find_by_</tt>, so you get finders like <tt>Person.find_by_user_name,
1012   Payment.find_by_transaction_id</tt>. So instead of writing <tt>Person.find_first(["user_name = ?", user_name])</tt>, you just do
1013   <tt>Person.find_by_user_name(user_name)</tt>.
1014  
1015   It's also possible to use multiple attributes in the same find by separating them with "_and_", so you get finders like
1016   <tt>Person.find_by_user_name_and_password</tt> or even <tt>Payment.find_by_purchaser_and_state_and_country</tt>. So instead of writing
1017   <tt>Person.find_first(["user_name = ? AND password = ?", user_name, password])</tt>, you just do
1018   <tt>Person.find_by_user_name_and_password(user_name, password)</tt>.
1019
1020   While primarily a construct for easier find_firsts, it can also be used as a construct for find_all by using calls like
1021   <tt>Payment.find_all_by_amount(50)</tt> that is turned into <tt>Payment.find_all(["amount = ?", 50])</tt>. This is something not as equally useful,
1022   though, as it's not possible to specify the order in which the objects are returned.
1023
1024 * Added block-style for callbacks #332 [Jeremy Kemper].
1025
1026     Before:
1027       before_destroy(Proc.new{ |record| Person.destroy_all "firm_id = #{record.id}" })
1028    
1029     After:
1030       before_destroy { |record| Person.destroy_all "firm_id = #{record.id}" }
1031
1032 * Added :counter_cache option to acts_as_tree that works just like the one you can define on belongs_to #371 [Josh]
1033
1034 * Added Base.default_timezone accessor that determines whether to use Time.local (using :local) or Time.utc (using :utc) when pulling dates
1035   and times from the database. This is set to :local by default.
1036
1037 * Added the possibility for adapters to overwrite add_limit! to implement a different limiting scheme than "LIMIT X" used by MySQL, PostgreSQL, and SQLite.
1038
1039 * Added the possibility of having objects with acts_as_list created before their scope is available or...
1040
1041 * Added a db2 adapter that only depends on the Ruby/DB2 bindings (http://raa.ruby-lang.org/project/ruby-db2/) #386 [Maik Schmidt]
1042
1043 * Added the final touches to the Microsoft SQL Server adapter by Joey Gibson that makes it suitable for actual use #394 [DeLynn Barry]
1044
1045 * Added that Base#find takes an optional options hash, including :conditions. Base#find_on_conditions deprecated in favor of #find with :conditions #407 [Jeremy Kemper]
1046
1047 * Added HasManyAssociation#count that works like Base#count #413 [intinig]
1048
1049