| 1 |
*1.14.1* (April 6th, 2005) |
|---|
| 2 |
|
|---|
| 3 |
* Fix type_name_with_module to handle type names that begin with '::'. Closes #4614. [Nicholas Seckar] |
|---|
| 4 |
|
|---|
| 5 |
* Fixed that that multiparameter assignment doesn't work with aggregations (closes #4620) [Lars Pind] |
|---|
| 6 |
|
|---|
| 7 |
* Enable Limit/Offset in Calculations (closes #4558) [lmarlow@yahoo.com] |
|---|
| 8 |
|
|---|
| 9 |
* Fixed that loading including associations returns all results if Load IDs For Limited Eager Loading returns none (closes #4528) [Rick] |
|---|
| 10 |
|
|---|
| 11 |
* Fixed HasManyAssociation#find bugs when :finder_sql is set #4600 [lagroue@free.fr] |
|---|
| 12 |
|
|---|
| 13 |
* Allow AR::Base#respond_to? to behave when @attributes is nil [zenspider] |
|---|
| 14 |
|
|---|
| 15 |
* Support eager includes when going through a polymorphic has_many association. [Rick] |
|---|
| 16 |
|
|---|
| 17 |
* Added support for eagerly including polymorphic has_one associations. (closes #4525) [Rick] |
|---|
| 18 |
|
|---|
| 19 |
class Post < ActiveRecord::Base |
|---|
| 20 |
has_one :tagging, :as => :taggable |
|---|
| 21 |
end |
|---|
| 22 |
|
|---|
| 23 |
Post.find :all, :include => :tagging |
|---|
| 24 |
|
|---|
| 25 |
* Added descriptive error messages for invalid has_many :through associations: going through :has_one or :has_and_belongs_to_many [Rick] |
|---|
| 26 |
|
|---|
| 27 |
* Added support for going through a polymorphic has_many association: (closes #4401) [Rick] |
|---|
| 28 |
|
|---|
| 29 |
class PhotoCollection < ActiveRecord::Base |
|---|
| 30 |
has_many :photos, :as => :photographic |
|---|
| 31 |
belongs_to :firm |
|---|
| 32 |
end |
|---|
| 33 |
|
|---|
| 34 |
class Firm < ActiveRecord::Base |
|---|
| 35 |
has_many :photo_collections |
|---|
| 36 |
has_many :photos, :through => :photo_collections |
|---|
| 37 |
end |
|---|
| 38 |
|
|---|
| 39 |
* Multiple fixes and optimizations in PostgreSQL adapter, allowing ruby-postgres gem to work properly. [ruben.nine@gmail.com] |
|---|
| 40 |
|
|---|
| 41 |
* Fixed that AssociationCollection#delete_all should work even if the records of the association are not loaded yet. [Florian Weber] |
|---|
| 42 |
|
|---|
| 43 |
* Changed those private ActiveRecord methods to take optional third argument :auto instead of nil for performance optimizations. (closes #4456) [Stefan] |
|---|
| 44 |
|
|---|
| 45 |
* Private ActiveRecord methods add_limit!, add_joins!, and add_conditions! take an OPTIONAL third argument 'scope' (closes #4456) [Rick] |
|---|
| 46 |
|
|---|
| 47 |
* DEPRECATED: Using additional attributes on has_and_belongs_to_many associations. Instead upgrade your association to be a real join model [DHH] |
|---|
| 48 |
|
|---|
| 49 |
* Fixed that records returned from has_and_belongs_to_many associations with additional attributes should be marked as read only (fixes #4512) [DHH] |
|---|
| 50 |
|
|---|
| 51 |
* Do not implicitly mark recordss of has_many :through as readonly but do mark habtm records as readonly (eventually only on join tables without rich attributes). [Marcel Mollina Jr.] |
|---|
| 52 |
|
|---|
| 53 |
* Fixed broken OCIAdapter #4457 [schoenm@earthlink.net] |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
*1.14.0* (March 27th, 2005) |
|---|
| 57 |
|
|---|
| 58 |
* Replace 'rescue Object' with a finer grained rescue. Closes #4431. [Nicholas Seckar] |
|---|
| 59 |
|
|---|
| 60 |
* Fixed eager loading so that an aliased table cannot clash with a has_and_belongs_to_many join table [Rick] |
|---|
| 61 |
|
|---|
| 62 |
* Add support for :include to with_scope [andrew@redlinesoftware.com] |
|---|
| 63 |
|
|---|
| 64 |
* Support the use of public synonyms with the Oracle adapter; required ruby-oci8 v0.1.14 #4390 [schoenm@earthlink.net] |
|---|
| 65 |
|
|---|
| 66 |
* Change periods (.) in table aliases to _'s. Closes #4251 [jeff@ministrycentered.com] |
|---|
| 67 |
|
|---|
| 68 |
* Changed has_and_belongs_to_many join to INNER JOIN for Mysql 3.23.x. Closes #4348 [Rick] |
|---|
| 69 |
|
|---|
| 70 |
* Fixed issue that kept :select options from being scoped [Rick] |
|---|
| 71 |
|
|---|
| 72 |
* Fixed db_schema_import when binary types are present #3101 [DHH] |
|---|
| 73 |
|
|---|
| 74 |
* Fixed that MySQL enums should always be returned as strings #3501 [DHH] |
|---|
| 75 |
|
|---|
| 76 |
* Change has_many :through to use the :source option to specify the source association. :class_name is now ignored. [Rick Olson] |
|---|
| 77 |
|
|---|
| 78 |
class Connection < ActiveRecord::Base |
|---|
| 79 |
belongs_to :user |
|---|
| 80 |
belongs_to :channel |
|---|
| 81 |
end |
|---|
| 82 |
|
|---|
| 83 |
class Channel < ActiveRecord::Base |
|---|
| 84 |
has_many :connections |
|---|
| 85 |
has_many :contacts, :through => :connections, :class_name => 'User' # OLD |
|---|
| 86 |
has_many :contacts, :through => :connections, :source => :user # NEW |
|---|
| 87 |
end |
|---|
| 88 |
|
|---|
| 89 |
* Fixed DB2 adapter so nullable columns will be determines correctly now and quotes from column default values will be removed #4350 [contact@maik-schmidt.de] |
|---|
| 90 |
|
|---|
| 91 |
* Allow overriding of find parameters in scoped has_many :through calls [Rick Olson] |
|---|
| 92 |
|
|---|
| 93 |
In this example, :include => false disables the default eager association from loading. :select changes the standard |
|---|
| 94 |
select clause. :joins specifies a join that is added to the end of the has_many :through query. |
|---|
| 95 |
|
|---|
| 96 |
class Post < ActiveRecord::Base |
|---|
| 97 |
has_many :tags, :through => :taggings, :include => :tagging do |
|---|
| 98 |
def add_joins_and_select |
|---|
| 99 |
find :all, :select => 'tags.*, authors.id as author_id', :include => false, |
|---|
| 100 |
:joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id' |
|---|
| 101 |
end |
|---|
| 102 |
end |
|---|
| 103 |
end |
|---|
| 104 |
|
|---|
| 105 |
* Fixed that schema changes while the database was open would break any connections to a SQLite database (now we reconnect if that error is throw) [DHH] |
|---|
| 106 |
|
|---|
| 107 |
* Don't classify the has_one class when eager loading, it is already singular. Add tests. (closes #4117) [jonathan@bluewire.net.nz] |
|---|
| 108 |
|
|---|
| 109 |
* Quit ignoring default :include options in has_many :through calls [Mark James] |
|---|
| 110 |
|
|---|
| 111 |
* Allow has_many :through associations to find the source association by setting a custom class (closes #4307) [jonathan@bluewire.net.nz] |
|---|
| 112 |
|
|---|
| 113 |
* Eager Loading support added for has_many :through => :has_many associations (see below). [Rick Olson] |
|---|
| 114 |
|
|---|
| 115 |
* Allow has_many :through to work on has_many associations (closes #3864) [sco@scottraymond.net] Example: |
|---|
| 116 |
|
|---|
| 117 |
class Firm < ActiveRecord::Base |
|---|
| 118 |
has_many :clients |
|---|
| 119 |
has_many :invoices, :through => :clients |
|---|
| 120 |
end |
|---|
| 121 |
|
|---|
| 122 |
class Client < ActiveRecord::Base |
|---|
| 123 |
belongs_to :firm |
|---|
| 124 |
has_many :invoices |
|---|
| 125 |
end |
|---|
| 126 |
|
|---|
| 127 |
class Invoice < ActiveRecord::Base |
|---|
| 128 |
belongs_to :client |
|---|
| 129 |
end |
|---|
| 130 |
|
|---|
| 131 |
* Raise error when trying to select many polymorphic objects with has_many :through or :include (closes #4226) [josh@hasmanythrough.com] |
|---|
| 132 |
|
|---|
| 133 |
* Fixed has_many :through to include :conditions set on the :through association. closes #4020 [jonathan@bluewire.net.nz] |
|---|
| 134 |
|
|---|
| 135 |
* Fix that has_many :through honors the foreign key set by the belongs_to association in the join model (closes #4259) [andylien@gmail.com / Rick] |
|---|
| 136 |
|
|---|
| 137 |
* SQL Server adapter gets some love #4298 [rtomayko@gmail.com] |
|---|
| 138 |
|
|---|
| 139 |
* Added OpenBase database adapter that builds on top of the http://www.spice-of-life.net/ruby-openbase/ driver. All functionality except LIMIT/OFFSET is supported #3528 [derrickspell@cdmplus.com] |
|---|
| 140 |
|
|---|
| 141 |
* Rework table aliasing to account for truncated table aliases. Add smarter table aliasing when doing eager loading of STI associations. This allows you to use the association name in the order/where clause. [Jonathan Viney / Rick Olson] #4108 Example (SpecialComment is using STI): |
|---|
| 142 |
|
|---|
| 143 |
Author.find(:all, :include => { :posts => :special_comments }, :order => 'special_comments.body') |
|---|
| 144 |
|
|---|
| 145 |
* Add AbstractAdapter#table_alias_for to create table aliases according to the rules of the current adapter. [Rick] |
|---|
| 146 |
|
|---|
| 147 |
* Provide access to the underlying database connection through Adapter#raw_connection. Enables the use of db-specific methods without complicating the adapters. #2090 [Koz] |
|---|
| 148 |
|
|---|
| 149 |
* Remove broken attempts at handling columns with a default of 'now()' in the postgresql adapter. #2257 [Koz] |
|---|
| 150 |
|
|---|
| 151 |
* Added connection#current_database that'll return of the current database (only works in MySQL, SQL Server, and Oracle so far -- please help implement for the rest of the adapters) #3663 [Tom ward] |
|---|
| 152 |
|
|---|
| 153 |
* Fixed that Migration#execute would have the table name prefix appended to its query #4110 [mark.imbriaco@pobox.com] |
|---|
| 154 |
|
|---|
| 155 |
* Make all tinyint(1) variants act like boolean in mysql (tinyint(1) unsigned, etc.) [Jamis Buck] |
|---|
| 156 |
|
|---|
| 157 |
* Use association's :conditions when eager loading. [jeremyevans0@gmail.com] #4144 |
|---|
| 158 |
|
|---|
| 159 |
* Alias the has_and_belongs_to_many join table on eager includes. #4106 [jeremyevans0@gmail.com] |
|---|
| 160 |
|
|---|
| 161 |
This statement would normally error because the projects_developers table is joined twice, and therefore joined_on would be ambiguous. |
|---|
| 162 |
|
|---|
| 163 |
Developer.find(:all, :include => {:projects => :developers}, :conditions => 'join_project_developers.joined_on IS NOT NULL') |
|---|
| 164 |
|
|---|
| 165 |
* Oracle adapter gets some love #4230 [schoenm@earthlink.net] |
|---|
| 166 |
|
|---|
| 167 |
* Changes :text to CLOB rather than BLOB [Moses Hohman] |
|---|
| 168 |
* Fixes an issue with nil numeric length/scales (several) |
|---|
| 169 |
* Implements support for XMLTYPE columns [wilig / Kubo Takehiro] |
|---|
| 170 |
* Tweaks a unit test to get it all green again |
|---|
| 171 |
* Adds support for #current_database |
|---|
| 172 |
|
|---|
| 173 |
* Added Base.abstract_class? that marks which classes are not part of the Active Record hierarchy #3704 [Rick Olson] |
|---|
| 174 |
|
|---|
| 175 |
class CachedModel < ActiveRecord::Base |
|---|
| 176 |
self.abstract_class = true |
|---|
| 177 |
end |
|---|
| 178 |
|
|---|
| 179 |
class Post < CachedModel |
|---|
| 180 |
end |
|---|
| 181 |
|
|---|
| 182 |
CachedModel.abstract_class? |
|---|
| 183 |
=> true |
|---|
| 184 |
|
|---|
| 185 |
Post.abstract_class? |
|---|
| 186 |
=> false |
|---|
| 187 |
|
|---|
| 188 |
Post.base_class |
|---|
| 189 |
=> Post |
|---|
| 190 |
|
|---|
| 191 |
Post.table_name |
|---|
| 192 |
=> 'posts' |
|---|
| 193 |
|
|---|
| 194 |
* Allow :dependent options to be used with polymorphic joins. #3820 [Rick Olson] |
|---|
| 195 |
|
|---|
| 196 |
class Foo < ActiveRecord::Base |
|---|
| 197 |
has_many :attachments, :as => :attachable, :dependent => :delete_all |
|---|
| 198 |
end |
|---|
| 199 |
|
|---|
| 200 |
* Nicer error message on has_many :through when :through reflection can not be found. #4042 [court3nay@gmail.com] |
|---|
| 201 |
|
|---|
| 202 |
* Upgrade to Transaction::Simple 1.3 [Jamis Buck] |
|---|
| 203 |
|
|---|
| 204 |
* Catch FixtureClassNotFound when using instantiated fixtures on a fixture that has no ActiveRecord model [Rick Olson] |
|---|
| 205 |
|
|---|
| 206 |
* Allow ordering of calculated results and/or grouped fields in calculations [solo@gatelys.com] |
|---|
| 207 |
|
|---|
| 208 |
* Make ActiveRecord::Base#save! return true instead of nil on success. #4173 [johan@johansorensen.com] |
|---|
| 209 |
|
|---|
| 210 |
* Dynamically set allow_concurrency. #4044 [Stefan Kaes] |
|---|
| 211 |
|
|---|
| 212 |
* Added Base#to_xml that'll turn the current record into a XML representation [DHH]. Example: |
|---|
| 213 |
|
|---|
| 214 |
topic.to_xml |
|---|
| 215 |
|
|---|
| 216 |
...returns: |
|---|
| 217 |
|
|---|
| 218 |
<?xml version="1.0" encoding="UTF-8"?> |
|---|
| 219 |
<topic> |
|---|
| 220 |
<title>The First Topic</title> |
|---|
| 221 |
<author-name>David</author-name> |
|---|
| 222 |
<id type="integer">1</id> |
|---|
| 223 |
<approved type="boolean">false</approved> |
|---|
| 224 |
<replies-count type="integer">0</replies-count> |
|---|
| 225 |
<bonus-time type="datetime">2000-01-01 08:28:00</bonus-time> |
|---|
| 226 |
<written-on type="datetime">2003-07-16 09:28:00</written-on> |
|---|
| 227 |
<content>Have a nice day</content> |
|---|
| 228 |
<author-email-address>david@loudthinking.com</author-email-address> |
|---|
| 229 |
<parent-id></parent-id> |
|---|
| 230 |
<last-read type="date">2004-04-15</last-read> |
|---|
| 231 |
</topic> |
|---|
| 232 |
|
|---|
| 233 |
...and you can configure with: |
|---|
| 234 |
|
|---|
| 235 |
topic.to_xml(:skip_instruct => true, :except => [ :id, bonus_time, :written_on, replies_count ]) |
|---|
| 236 |
|
|---|
| 237 |
...that'll return: |
|---|
| 238 |
|
|---|
| 239 |
<topic> |
|---|
| 240 |
<title>The First Topic</title> |
|---|
| 241 |
<author-name>David</author-name> |
|---|
| 242 |
<approved type="boolean">false</approved> |
|---|
| 243 |
<content>Have a nice day</content> |
|---|
| 244 |
<author-email-address>david@loudthinking.com</author-email-address> |
|---|
| 245 |
<parent-id></parent-id> |
|---|
| 246 |
<last-read type="date">2004-04-15</last-read> |
|---|
| 247 |
</topic> |
|---|
| 248 |
|
|---|
| 249 |
You can even do load first-level associations as part of the document: |
|---|
| 250 |
|
|---|
| 251 |
firm.to_xml :include => [ :account, :clients ] |
|---|
| 252 |
|
|---|
| 253 |
...that'll return something like: |
|---|
| 254 |
|
|---|
| 255 |
<?xml version="1.0" encoding="UTF-8"?> |
|---|
| 256 |
<firm> |
|---|
| 257 |
<id type="integer">1</id> |
|---|
| 258 |
<rating type="integer">1</rating> |
|---|
| 259 |
<name>37signals</name> |
|---|
| 260 |
<clients> |
|---|
| 261 |
<client> |
|---|
| 262 |
<rating type="integer">1</rating> |
|---|
| 263 |
<name>Summit</name> |
|---|
| 264 |
</client> |
|---|
| 265 |
<client> |
|---|
| 266 |
<rating type="integer">1</rating> |
|---|
| 267 |
<name>Microsoft</name> |
|---|
| 268 |
</client> |
|---|
| 269 |
</clients> |
|---|
| 270 |
<account> |
|---|
| 271 |
<id type="integer">1</id> |
|---|
| 272 |
<credit-limit type="integer">50</credit-limit> |
|---|
| 273 |
</account> |
|---|
| 274 |
</firm> |
|---|
| 275 |
|
|---|
| 276 |
* Allow :counter_cache to take a column name for custom counter cache columns [Jamis Buck] |
|---|
| 277 |
|
|---|
| 278 |
* Documentation fixes for :dependent [robby@planetargon.com] |
|---|
| 279 |
|
|---|
| 280 |
* Stop the MySQL adapter crashing when views are present. #3782 [Jonathan Viney] |
|---|
| 281 |
|
|---|
| 282 |
* Don't classify the belongs_to class, it is already singular #4117 [keithm@infused.org] |
|---|
| 283 |
|
|---|
| 284 |
* Allow set_fixture_class to take Classes instead of strings for a class in a module. Raise FixtureClassNotFound if a fixture can't load. [Rick Olson] |
|---|
| 285 |
|
|---|
| 286 |
* Fix quoting of inheritance column for STI eager loading #4098 [Jonathan Viney <jonathan@bluewire.net.nz>] |
|---|
| 287 |
|
|---|
| 288 |
* Added smarter table aliasing for eager associations for multiple self joins #3580 [Rick Olson] |
|---|
| 289 |
|
|---|
| 290 |
* The first time a table is referenced in a join, no alias is used. |
|---|
| 291 |
* After that, the parent class name and the reflection name are used. |
|---|
| 292 |
|
|---|
| 293 |
Tree.find(:all, :include => :children) # LEFT OUTER JOIN trees AS tree_children ... |
|---|
| 294 |
|
|---|
| 295 |
* Any additional join references get a numerical suffix like '_2', '_3', etc. |
|---|
| 296 |
|
|---|
| 297 |
* Fixed eager loading problems with single-table inheritance #3580 [Rick Olson]. Post.find(:all, :include => :special_comments) now returns all posts, and any special comments that the posts may have. And made STI work with has_many :through and polymorphic belongs_to. |
|---|
| 298 |
|
|---|
| 299 |
* Added cascading eager loading that allows for queries like Author.find(:all, :include=> { :posts=> :comments }), which will fetch all authors, their posts, and the comments belonging to those posts in a single query (using LEFT OUTER JOIN) #3913 [anna@wota.jp]. Examples: |
|---|
| 300 |
|
|---|
| 301 |
# cascaded in two levels |
|---|
| 302 |
>> Author.find(:all, :include=>{:posts=>:comments}) |
|---|
| 303 |
=> authors |
|---|
| 304 |
+- posts |
|---|
| 305 |
+- comments |
|---|
| 306 |
|
|---|
| 307 |
# cascaded in two levels and normal association |
|---|
| 308 |
>> Author.find(:all, :include=>[{:posts=>:comments}, :categorizations]) |
|---|
| 309 |
=> authors |
|---|
| 310 |
+- posts |
|---|
| 311 |
+- comments |
|---|
| 312 |
+- categorizations |
|---|
| 313 |
|
|---|
| 314 |
# cascaded in two levels with two has_many associations |
|---|
| 315 |
>> Author.find(:all, :include=>{:posts=>[:comments, :categorizations]}) |
|---|
| 316 |
=> authors |
|---|
| 317 |
+- posts |
|---|
| 318 |
+- comments |
|---|
| 319 |
+- categorizations |
|---|
| 320 |
|
|---|
| 321 |
# cascaded in three levels |
|---|
| 322 |
>> Company.find(:all, :include=>{:groups=>{:members=>{:favorites}}}) |
|---|
| 323 |
=> companies |
|---|
| 324 |
+- groups |
|---|
| 325 |
+- members |
|---|
| 326 |
+- favorites |
|---|
| 327 |
|
|---|
| 328 |
* Make counter cache work when replacing an association #3245 [eugenol@gmail.com] |
|---|
| 329 |
|
|---|
| 330 |
* Make migrations verbose [Jamis Buck] |
|---|
| 331 |
|
|---|
| 332 |
* Make counter_cache work with polymorphic belongs_to [Jamis Buck] |
|---|
| 333 |
|
|---|
| 334 |
* Fixed that calling HasOneProxy#build_model repeatedly would cause saving to happen #4058 [anna@wota.jp] |
|---|
| 335 |
|
|---|
| 336 |
* Added Sybase database adapter that relies on the Sybase Open Client bindings (see http://raa.ruby-lang.org/project/sybase-ctlib) #3765 [John Sheets]. It's almost completely Active Record compliant (including migrations), but has the following caveats: |
|---|
| 337 |
|
|---|
| 338 |
* Does not support DATE SQL column types; use DATETIME instead. |
|---|
| 339 |
* Date columns on HABTM join tables are returned as String, not Time. |
|---|
| 340 |
* Insertions are potentially broken for :polymorphic join tables |
|---|
| 341 |
* BLOB column access not yet fully supported |
|---|
| 342 |
|
|---|
| 343 |
* Clear stale, cached connections left behind by defunct threads. [Jeremy Kemper] |
|---|
| 344 |
|
|---|
| 345 |
* CHANGED DEFAULT: set ActiveRecord::Base.allow_concurrency to false. Most AR usage is in single-threaded applications. [Jeremy Kemper] |
|---|
| 346 |
|
|---|
| 347 |
* Renamed the "oci" adapter to "oracle", but kept the old name as an alias #4017 [schoenm@earthlink.net] |
|---|
| 348 |
|
|---|
| 349 |
* Fixed that Base.save should always return false if the save didn't succeed, including if it has halted by before_save's #1861, #2477 [DHH] |
|---|
| 350 |
|
|---|
| 351 |
* Speed up class -> connection caching and stale connection verification. #3979 [Stefan Kaes] |
|---|
| 352 |
|
|---|
| 353 |
* Add set_fixture_class to allow the use of table name accessors with models which use set_table_name. [Kevin Clark] |
|---|
| 354 |
|
|---|
| 355 |
* Added that fixtures to placed in subdirectories of the main fixture files are also loaded #3937 [dblack@wobblini.net] |
|---|
| 356 |
|
|---|
| 357 |
* Define attribute query methods to avoid method_missing calls. #3677 [jonathan@bluewire.net.nz] |
|---|
| 358 |
|
|---|
| 359 |
* ActiveRecord::Base.remove_connection explicitly closes database connections and doesn't corrupt the connection cache. Introducing the disconnect! instance method for the PostgreSQL, MySQL, and SQL Server adapters; implementations for the others are welcome. #3591 [Simon Stapleton, Tom Ward] |
|---|
| 360 |
|
|---|
| 361 |
* Added support for nested scopes #3407 [anna@wota.jp]. Examples: |
|---|
| 362 |
|
|---|
| 363 |
Developer.with_scope(:find => { :conditions => "salary > 10000", :limit => 10 }) do |
|---|
| 364 |
Developer.find(:all) # => SELECT * FROM developers WHERE (salary > 10000) LIMIT 10 |
|---|
| 365 |
|
|---|
| 366 |
# inner rule is used. (all previous parameters are ignored) |
|---|
| 367 |
Developer.with_exclusive_scope(:find => { :conditions => "name = 'Jamis'" }) do |
|---|
| 368 |
Developer.find(:all) # => SELECT * FROM developers WHERE (name = 'Jamis') |
|---|
| 369 |
end |
|---|
| 370 |
|
|---|
| 371 |
# parameters are merged |
|---|
| 372 |
Developer.with_scope(:find => { :conditions => "name = 'Jamis'" }) do |
|---|
| 373 |
Developer.find(:all) # => SELECT * FROM developers WHERE (( salary > 10000 ) AND ( name = 'Jamis' )) LIMIT 10 |
|---|
| 374 |
end |
|---|
| 375 |
end |
|---|
| 376 |
|
|---|
| 377 |
* Fixed db2 connection with empty user_name and auth options #3622 [phurley@gmail.com] |
|---|
| 378 |
|
|---|
| 379 |
* Fixed validates_length_of to work on UTF-8 strings by using characters instead of bytes #3699 [Masao Mutoh] |
|---|
| 380 |
|
|---|
| 381 |
* Fixed that reflections would bleed across class boundaries in single-table inheritance setups #3796 [lars@pind.com] |
|---|
| 382 |
|
|---|
| 383 |
* Added calculations: Base.count, Base.average, Base.sum, Base.minimum, Base.maxmium, and the generic Base.calculate. All can be used with :group and :having. Calculations and statitics need no longer require custom SQL. #3958 [Rick Olson]. Examples: |
|---|
| 384 |
|
|---|
| 385 |
Person.average :age |
|---|
| 386 |
Person.minimum :age |
|---|
| 387 |
Person.maximum :age |
|---|
| 388 |
Person.sum :salary, :group => :last_name |
|---|
| 389 |
|
|---|
| 390 |
* Renamed Errors#count to Errors#size but kept an alias for the old name (and included an alias for length too) #3920 [contact@lukeredpath.co.uk] |
|---|
| 391 |
|
|---|
| 392 |
* Reflections don't attempt to resolve module nesting of association classes. Simplify type computation. [Jeremy Kemper] |
|---|
| 393 |
|
|---|
| 394 |
* Improved the Oracle OCI Adapter with better performance for column reflection (from #3210), fixes to migrations (from #3476 and #3742), tweaks to unit tests (from #3610), and improved documentation (from #2446) #3879 [Aggregated by schoenm@earthlink.net] |
|---|
| 395 |
|
|---|
| 396 |
* Fixed that the schema_info table used by ActiveRecord::Schema.define should respect table pre- and suffixes #3834 [rubyonrails@atyp.de] |
|---|
| 397 |
|
|---|
| 398 |
* Added :select option to Base.count that'll allow you to select something else than * to be counted on. Especially important for count queries using DISTINCT #3839 [skaes] |
|---|
| 399 |
|
|---|
| 400 |
* Correct syntax error in mysql DDL, and make AAACreateTablesTest run first [Bob Silva] |
|---|
| 401 |
|
|---|
| 402 |
* Allow :include to be used with has_many :through associations #3611 [Michael Schoen] |
|---|
| 403 |
|
|---|
| 404 |
* PostgreSQL: smarter schema dumps using pk_and_sequence_for(table). #2920 [Blair Zajac] |
|---|
| 405 |
|
|---|
| 406 |
* SQLServer: more compatible limit/offset emulation. #3779 [Tom Ward] |
|---|
| 407 |
|
|---|
| 408 |
* Polymorphic join support for has_one associations (has_one :foo, :as => :bar) #3785 [Rick Olson] |
|---|
| 409 |
|
|---|
| 410 |
* PostgreSQL: correctly parse negative integer column defaults. #3776 [bellis@deepthought.org] |
|---|
| 411 |
|
|---|
| 412 |
* Fix problems with count when used with :include [Jeremy Hopple and Kevin Clark] |
|---|
| 413 |
|
|---|
| 414 |
* ActiveRecord::RecordInvalid now states which validations failed in its default error message [Tobias Luetke] |
|---|
| 415 |
|
|---|
| 416 |
* Using AssociationCollection#build with arrays of hashes should call build, not create [DHH] |
|---|
| 417 |
|
|---|
| 418 |
* Remove definition of reloadable? from ActiveRecord::Base to make way for new Reloadable code. [Nicholas Seckar] |
|---|
| 419 |
|
|---|
| 420 |
* Fixed schema handling for DB2 adapter that didn't work: an initial schema could be set, but it wasn't used when getting tables and indexes #3678 [Maik Schmidt] |
|---|
| 421 |
|
|---|
| 422 |
* Support the :column option for remove_index with the PostgreSQL adapter. #3661 [shugo@ruby-lang.org] |
|---|
| 423 |
|
|---|
| 424 |
* Add documentation for add_index and remove_index. #3600 [Manfred Stienstra <m.stienstra@fngtps.com>] |
|---|
| 425 |
|
|---|
| 426 |
* If the OCI library is not available, raise an exception indicating as much. #3593 [schoenm@earthlink.net] |
|---|
| 427 |
|
|---|
| 428 |
* Add explicit :order in finder tests as postgresql orders results differently by default. #3577. [Rick Olson] |
|---|
| 429 |
|
|---|
| 430 |
* Make dynamic finders honor additional passed in :conditions. #3569 [Oleg Pudeyev <pudeyo@rpi.edu>, Marcel Molina Jr.] |
|---|
| 431 |
|
|---|
| 432 |
* Show a meaningful error when the DB2 adapter cannot be loaded due to missing dependencies. [Nicholas Seckar] |
|---|
| 433 |
|
|---|
| 434 |
* Make .count work for has_many associations with multi line finder sql [schoenm@earthlink.net] |
|---|
| 435 |
|
|---|
| 436 |
* Add AR::Base.base_class for querying the ancestor AR::Base subclass [Jamis Buck] |
|---|
| 437 |
|
|---|
| 438 |
* Allow configuration of the column used for optimistic locking [wilsonb@gmail.com] |
|---|
| 439 |
|
|---|
| 440 |
* Don't hardcode 'id' in acts as list. [ror@philippeapril.com] |
|---|
| 441 |
|
|---|
| 442 |
* Fix date errors for SQLServer in association tests. #3406 [kevin.clark@gmal.com] |
|---|
| 443 |
|
|---|
| 444 |
* Escape database name in MySQL adapter when creating and dropping databases. #3409 [anna@wota.jp] |
|---|
| 445 |
|
|---|
| 446 |
* Disambiguate table names for columns in validates_uniquness_of's WHERE clause. #3423 [alex.borovsky@gmail.com] |
|---|
| 447 |
|
|---|
| 448 |
* .with_scope imposed create parameters now bypass attr_protected [Tobias Luetke] |
|---|
| 449 |
|
|---|
| 450 |
* Don't raise an exception when there are more keys than there are named bind variables when sanitizing conditions. [Marcel Molina Jr.] |
|---|
| 451 |
|
|---|
| 452 |
* Multiple enhancements and adjustments to DB2 adaptor. #3377 [contact@maik-schmidt.de] |
|---|
| 453 |
|
|---|
| 454 |
* Sanitize scoped conditions. [Marcel Molina Jr.] |
|---|
| 455 |
|
|---|
| 456 |
* Added option to Base.reflection_of_all_associations to specify a specific association to scope the call. For example Base.reflection_of_all_associations(:has_many) [DHH] |
|---|
| 457 |
|
|---|
| 458 |
* Added ActiveRecord::SchemaDumper.ignore_tables which tells SchemaDumper which tables to ignore. Useful for tables with funky column like the ones required for tsearch2. [TobiasLuetke] |
|---|
| 459 |
|
|---|
| 460 |
* SchemaDumper now doesn't fail anymore when there are unknown column types in the schema. Instead the table is ignored and a Comment is left in the schema.rb. [TobiasLuetke] |
|---|
| 461 |
|
|---|
| 462 |
* Fixed that saving a model with multiple habtm associations would only save the first one. #3244 [yanowitz-rubyonrails@quantumfoam.org, Florian Weber] |
|---|
| 463 |
|
|---|
| 464 |
* Fix change_column to work with PostgreSQL 7.x and 8.x. #3141 [wejn@box.cz, Rick Olson, Scott Barron] |
|---|
| 465 |
|
|---|
| 466 |
* removed :piggyback in favor of just allowing :select on :through associations. [Tobias Luetke] |
|---|
| 467 |
|
|---|
| 468 |
* made method missing delegation to class methods on relation target work on :through associations. [Tobias Luetke] |
|---|
| 469 |
|
|---|
| 470 |
* made .find() work on :through relations. [Tobias Luetke] |
|---|
| 471 |
|
|---|
| 472 |
* Fix typo in association docs. #3296. [Blair Zajac] |
|---|
| 473 |
|
|---|
| 474 |
* Fixed :through relations when using STI inherited classes would use the inherited class's name as foreign key on the join model [Tobias Luetke] |
|---|
| 475 |
|
|---|
| 476 |
*1.13.2* (December 13th, 2005) |
|---|
| 477 |
|
|---|
| 478 |
* Become part of Rails 1.0 |
|---|
| 479 |
|
|---|
| 480 |
* MySQL: allow encoding option for mysql.rb driver. [Jeremy Kemper] |
|---|
| 481 |
|
|---|
| 482 |
* Added option inheritance for find calls on has_and_belongs_to_many and has_many assosociations [DHH]. Example: |
|---|
| 483 |
|
|---|
| 484 |
class Post |
|---|
| 485 |
has_many :recent_comments, :class_name => "Comment", :limit => 10, :include => :author |
|---|
| 486 |
end |
|---|
| 487 |
|
|---|
| 488 |
post.recent_comments.find(:all) # Uses LIMIT 10 and includes authors |
|---|
| 489 |
post.recent_comments.find(:all, :limit => nil) # Uses no limit but include authors |
|---|
| 490 |
post.recent_comments.find(:all, :limit => nil, :include => nil) # Uses no limit and doesn't include authors |
|---|
| 491 |
|
|---|
| 492 |
* Added option to specify :group, :limit, :offset, and :select options from find on has_and_belongs_to_many and has_many assosociations [DHH] |
|---|
| 493 |
|
|---|
| 494 |
* MySQL: fixes for the bundled mysql.rb driver. #3160 [Justin Forder] |
|---|
| 495 |
|
|---|
| 496 |
* SQLServer: fix obscure optimistic locking bug. #3068 [kajism@yahoo.com] |
|---|
| 497 |
|
|---|
| 498 |
* SQLServer: support uniqueidentifier columns. #2930 [keithm@infused.org] |
|---|
| 499 |
|
|---|
| 500 |
* SQLServer: cope with tables names qualified by owner. #3067 [jeff@ministrycentered.com] |
|---|
| 501 |
|
|---|
| 502 |
* SQLServer: cope with columns with "desc" in the name. #1950 [Ron Lusk, Ryan Tomayko] |
|---|
| 503 |
|
|---|
| 504 |
* SQLServer: cope with primary keys with "select" in the name. #3057 [rdifrango@captechventures.com] |
|---|
| 505 |
|
|---|
| 506 |
* Oracle: active? performs a select instead of a commit. #3133 [Michael Schoen] |
|---|
| 507 |
|
|---|
| 508 |
* MySQL: more robust test for nullified result hashes. #3124 [Stefan Kaes] |
|---|
| 509 |
|
|---|
| 510 |
* Reloading an instance refreshes its aggregations as well as its associations. #3024 [François Beausolei] |
|---|
| 511 |
|
|---|
| 512 |
* Fixed that using :include together with :conditions array in Base.find would cause NoMethodError #2887 [Paul Hammmond] |
|---|
| 513 |
|
|---|
| 514 |
* PostgreSQL: more robust sequence name discovery. #3087 [Rick Olson] |
|---|
| 515 |
|
|---|
| 516 |
* Oracle: use syntax compatible with Oracle 8. #3131 [Michael Schoen] |
|---|
| 517 |
|
|---|
| 518 |
* 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] |
|---|
| 519 |
|
|---|
| 520 |
* Added preliminary support for polymorphic associations [DHH] |
|---|
| 521 |
|
|---|
| 522 |
* Added preliminary support for join models [DHH] |
|---|
| 523 |
|
|---|
| 524 |
* Allow validate_uniqueness_of to be scoped by more than just one column. #1559. [jeremy@jthopple.com, Marcel Molina Jr.] |
|---|
| 525 |
|
|---|
| 526 |
* Firebird: active? and reconnect! methods for handling stale connections. #428 [Ken Kunz <kennethkunz@gmail.com>] |
|---|
| 527 |
|
|---|
| 528 |
* Firebird: updated for FireRuby 0.4.0. #3009 [Ken Kunz <kennethkunz@gmail.com>] |
|---|
| 529 |
|
|---|
| 530 |
* MySQL and PostgreSQL: active? compatibility with the pure-Ruby driver. #428 [Jeremy Kemper] |
|---|
| 531 |
|
|---|
| 532 |
* Oracle: active? check pings the database rather than testing the last command status. #428 [Michael Schoen] |
|---|
| 533 |
|
|---|
| 534 |
* SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find. #2974 [kajism@yahoo.com] |
|---|
| 535 |
|
|---|
| 536 |
* Reloading a model doesn't lose track of its connection. #2996 [junk@miriamtech.com, Jeremy Kemper] |
|---|
| 537 |
|
|---|
| 538 |
* 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] |
|---|
| 539 |
|
|---|
| 540 |
* MySQL, PostgreSQL: reconnect! also reconfigures the connection. Otherwise, the connection 'loses' its settings if it times out and is reconnected. #2978 [Shugo Maeda] |
|---|
| 541 |
|
|---|
| 542 |
* has_and_belongs_to_many: use JOIN instead of LEFT JOIN. [Jeremy Kemper] |
|---|
| 543 |
|
|---|
| 544 |
* 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] |
|---|
| 545 |
|
|---|
| 546 |
* Add tasks to create, drop and rebuild the MySQL and PostgreSQL test databases. [Marcel Molina Jr.] |
|---|
| 547 |
|
|---|
| 548 |
* Correct boolean handling in generated reader methods. #2945 [don.park@gmail.com, Stefan Kaes] |
|---|
| 549 |
|
|---|
| 550 |
* Don't generate read methods for columns whose names are not valid ruby method names. #2946 [Stefan Kaes] |
|---|
| 551 |
|
|---|
| 552 |
* Document :force option to create_table. #2921 [Blair Zajac <blair@orcaware.com>] |
|---|
| 553 |
|
|---|
| 554 |
* Don't add the same conditions twice in has_one finder sql. #2916 [Jeremy Evans] |
|---|
| 555 |
|
|---|
| 556 |
* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.] |
|---|
| 557 |
|
|---|
| 558 |
* 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>] |
|---|
| 559 |
|
|---|
| 560 |
* SQLServer: active? and reconnect! methods for handling stale connections. #428 [kajism@yahoo.com, Tom Ward <tom@popdog.net>] |
|---|
| 561 |
|
|---|
| 562 |
* Associations handle case-equality more consistently: item.parts.is_a?(Array) and item.parts === Array. #1345 [MarkusQ@reality.com] |
|---|
| 563 |
|
|---|
| 564 |
* SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY. #2866 [kajism@yahoo.com, Tom Ward <tom@popdog.net>] |
|---|
| 565 |
|
|---|
| 566 |
* Oracle: active? and reconnect! methods for handling stale connections. Optionally retry queries after reconnect. #428 [Michael Schoen <schoenm@earthlink.net>] |
|---|
| 567 |
|
|---|
| 568 |
* Correct documentation for Base.delete_all. #1568 [Newhydra] |
|---|
| 569 |
|
|---|
| 570 |
* Oracle: test case for column default parsing. #2788 [Michael Schoen <schoenm@earthlink.net>] |
|---|
| 571 |
|
|---|
| 572 |
* Update documentation for Migrations. #2861 [Tom Werner <tom@cube6media.com>] |
|---|
| 573 |
|
|---|
| 574 |
* When AbstractAdapter#log rescues an exception, attempt to detect and reconnect to an inactive database connection. Connection adapter must respond to the active? and reconnect! instance methods. Initial support for PostgreSQL, MySQL, and SQLite. Make certain that all statements which may need reconnection are performed within a logged block: for example, this means no avoiding log(sql, name) { } if @logger.nil? #428 [Jeremy Kemper] |
|---|
| 575 |
|
|---|
| 576 |
* Oracle: Much faster column reflection. #2848 [Michael Schoen <schoenm@earthlink.net>] |
|---|
| 577 |
|
|---|
| 578 |
* Base.reset_sequence_name analogous to reset_table_name (mostly useful for testing). Base.define_attr_method allows nil values. [Jeremy Kemper] |
|---|
| 579 |
|
|---|
| 580 |
* PostgreSQL: smarter sequence name defaults, stricter last_insert_id, warn on pk without sequence. [Jeremy Kemper] |
|---|
| 581 |
|
|---|
| 582 |
* PostgreSQL: correctly discover custom primary key sequences. #2594 [Blair Zajac <blair@orcaware.com>, meadow.nnick@gmail.com, Jeremy Kemper] |
|---|
| 583 |
|
|---|
| 584 |
* SQLServer: don't report limits for unsupported field types. #2835 [Ryan Tomayko] |
|---|
| 585 |
|
|---|
| 586 |
* Include the Enumerable module in ActiveRecord::Errors. [Rick Bradley <rick@rickbradley.com>] |
|---|
| 587 |
|
|---|
| 588 |
* Add :group option, correspond to GROUP BY, to the find method and to the has_many association. #2818 [rubyonrails@atyp.de] |
|---|
| 589 |
|
|---|
| 590 |
* Don't cast nil or empty strings to a dummy date. #2789 [Rick Bradley <rick@rickbradley.com>] |
|---|
| 591 |
|
|---|
| 592 |
* acts_as_list plays nicely with inheritance by remembering the class which declared it. #2811 [rephorm@rephorm.com] |
|---|
| 593 |
|
|---|
| 594 |
* Fix sqlite adaptor's detection of missing dbfile or database declaration. [Nicholas Seckar] |
|---|
| 595 |
|
|---|
| 596 |
* Fixed acts_as_list for definitions without an explicit :order #2803 [jonathan@bluewire.net.nz] |
|---|
| 597 |
|
|---|
| 598 |
* 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] |
|---|
| 599 |
|
|---|
| 600 |
* Correct handling of complex order clauses with SQL Server limit emulation. #2770 [Tom Ward <tom@popdog.net>, Matt B.] |
|---|
| 601 |
|
|---|
| 602 |
* Correct whitespace problem in Oracle default column value parsing. #2788 [rick@rickbradley.com] |
|---|
| 603 |
|
|---|
| 604 |
* 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] |
|---|
| 605 |
|
|---|
| 606 |
* Deprecate the old, confusing :exclusively_dependent option in favor of :dependent => :delete_all. [Jeremy Kemper] |
|---|
| 607 |
|
|---|
| 608 |
* More compatible Oracle column reflection. #2771 [Ryan Davis <ryand-ruby@zenspider.com>, Michael Schoen <schoenm@earthlink.net>] |
|---|
| 609 |
|
|---|
| 610 |
|
|---|
| 611 |
*1.13.0* (November 7th, 2005) |
|---|
| 612 |
|
|---|
| 613 |
* Fixed faulty regex in get_table_name method (SQLServerAdapter) #2639 [Ryan Tomayko] |
|---|
| 614 |
|
|---|
| 615 |
* Added :include as an option for association declarations [DHH]. Example: |
|---|
| 616 |
|
|---|
| 617 |
has_many :posts, :include => [ :author, :comments ] |
|---|
| 618 |
|
|---|
| 619 |
* 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: |
|---|
| 620 |
|
|---|
| 621 |
Comment.with_scope(:find => { :conditions => 'active=true' }, :create => { :post_id => 5 }) do |
|---|
| 622 |
# Find where name = ? and active=true |
|---|
| 623 |
Comment.find :all, :conditions => ['name = ?', name] |
|---|
| 624 |
# Create comment associated with :post_id |
|---|
| 625 |
Comment.create :body => "Hello world" |
|---|
| 626 |
end |
|---|
| 627 |
|
|---|
| 628 |
* Fixed that SQL Server should ignore :size declarations on anything but integer and string in the agnostic schema representation #2756 [Ryan Tomayko] |
|---|
| 629 |
|
|---|
| 630 |
* Added constrain scoping for creates using a hash of attributes bound to the :creation key [DHH]. Example: |
|---|
| 631 |
|
|---|
| 632 |
Comment.constrain(:creation => { :post_id => 5 }) do |
|---|
| 633 |
# Associated with :post_id |
|---|
| 634 |
Comment.create :body => "Hello world" |
|---|
| 635 |
end |
|---|
| 636 |
|
|---|
| 637 |
This is rarely used directly, but allows for find_or_create on associations. So you can do: |
|---|
| 638 |
|
|---|
| 639 |
# If the tag doesn't exist, a new one is created that's associated with the person |
|---|
| 640 |
person.tags.find_or_create_by_name("Summer") |
|---|
| 641 |
|
|---|
| 642 |
* 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: |
|---|
| 643 |
|
|---|
| 644 |
# No 'Summer' tag exists |
|---|
| 645 |
Tag.find_or_create_by_name("Summer") # equal to Tag.create(:name => "Summer") |
|---|
| 646 |
|
|---|
| 647 |
# Now the 'Summer' tag does exist |
|---|
| 648 |
Tag.find_or_create_by_name("Summer") # equal to Tag.find_by_name("Summer") |
|---|
| 649 |
|
|---|
| 650 |
* Added extension capabilities to has_many and has_and_belongs_to_many proxies [DHH]. Example: |
|---|
| 651 |
|
|---|
| 652 |
class Account < ActiveRecord::Base |
|---|
| 653 |
has_many :people do |
|---|
| 654 |
def find_or_create_by_name(name) |
|---|
| 655 |
first_name, *last_name = name.split |
|---|
| 656 |
last_name = last_name.join " " |
|---|
| 657 |
|
|---|
| 658 |
find_or_create_by_first_name_and_last_name(first_name, last_name) |
|---|
| 659 |
end |
|---|
| 660 |
end |
|---|
| 661 |
end |
|---|
| 662 |
|
|---|
| 663 |
person = Account.find(:first).people.find_or_create_by_name("David Heinemeier Hansson") |
|---|
| 664 |
person.first_name # => "David" |
|---|
| 665 |
person.last_name # => "Heinemeier Hansson" |
|---|
| 666 |
|
|---|
| 667 |
Note that the anoymous module must be declared using brackets, not do/end (due to order of evaluation). |
|---|
| 668 |
|
|---|
| 669 |
* Omit internal dtproperties table from SQLServer table list. #2729 [rtomayko@gmail.com] |
|---|
| 670 |
|
|---|
| 671 |
* Quote column names in generated SQL. #2728 [rtomayko@gmail.com] |
|---|
| 672 |
|
|---|
| 673 |
* Correct the pure-Ruby MySQL 4.1.1 shim's version test. #2718 [Jeremy Kemper] |
|---|
| 674 |
|
|---|
| 675 |
* 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] |
|---|
| 676 |
|
|---|
| 677 |
* Correct fixture behavior when table name pluralization is off. #2719 [Rick Bradley <rick@rickbradley.com>] |
|---|
| 678 |
|
|---|
| 679 |
* Changed :dbfile to :database for SQLite adapter for consistency (old key still works as an alias) #2644 [Dan Peterson] |
|---|
| 680 |
|
|---|
| 681 |
* Added migration support for Oracle #2647 [Michael Schoen] |
|---|
| 682 |
|
|---|
| 683 |
* Worked around that connection can't be reset if allow_concurrency is off. #2648 [Michael Schoen <schoenm@earthlink.net>] |
|---|
| 684 |
|
|---|
| 685 |
* Fixed SQL Server adapter to pass even more tests and do even better #2634 [rtomayko@gmail.com] |
|---|
| 686 |
|
|---|
| 687 |
* Fixed SQL Server adapter so it honors options[:conditions] when applying :limits #1978 [Tom Ward] |
|---|
| 688 |
|
|---|
| 689 |
* Added migration support to SQL Server adapter (please someone do the same for Oracle and DB2) #2625 [Tom Ward] |
|---|
| 690 |
|
|---|
| 691 |
* Use AR::Base.silence rather than AR::Base.logger.silence in fixtures to preserve Log4r compatibility. #2618 [dansketcher@gmail.com] |
|---|
| 692 |
|
|---|
| 693 |
* Constraints are cloned so they can't be inadvertently modified while they're |
|---|
| 694 |
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>] |
|---|
| 695 |
|
|---|
| 696 |
* Added :offset and :limit to the kinds of options that Base.constrain can use #2466 [duane.johnson@gmail.com] |
|---|
| 697 |
|
|---|
| 698 |
* Fixed handling of nil number columns on Oracle and cleaned up tests for Oracle in general #2555 [schoenm@earthlink.net] |
|---|
| 699 |
|
|---|
| 700 |
* Added quoted_true and quoted_false methods and tables to db2_adapter and cleaned up tests for DB2 #2493, #2624 [maik schmidt] |
|---|
| 701 |
|
|---|
| 702 |
|
|---|
| 703 |
*1.12.2* (October 26th, 2005) |
|---|
| 704 |
|
|---|
| 705 |
* Allow symbols to rename columns when using SQLite adapter. #2531 [kevin.clark@gmail.com] |
|---|
| 706 |
|
|---|
| 707 |
* Map Active Record time to SQL TIME. #2575, #2576 [Robby Russell <robby@planetargon.com>] |
|---|
| 708 |
|
|---|
| 709 |
* Clarify semantics of ActiveRecord::Base#respond_to? #2560 [skaes@web.de] |
|---|
| 710 |
|
|---|
| 711 |
* Fixed Association#clear for associations which have not yet been accessed. #2524 [Patrick Lenz <patrick@lenz.sh>] |
|---|
| 712 |
|
|---|
| 713 |
* HABTM finders shouldn't return readonly records. #2525 [Patrick Lenz <patrick@lenz.sh>] |
|---|
| 714 |
|
|---|
| 715 |
* Make all tests runnable on their own. #2521. [Blair Zajac <blair@orcaware.com>] |
|---|
| 716 |
|
|---|
| 717 |
|
|---|
| 718 |
*1.12.1* (October 19th, 2005) |
|---|
| 719 |
|
|---|
| 720 |
* Always parenthesize :conditions options so they may be safely combined with STI and constraints. |
|---|
| 721 |
|
|---|
| 722 |
* Correct PostgreSQL primary key sequence detection. #2507 [tmornini@infomania.com] |
|---|
| 723 |
|
|---|
| 724 |
* Added support for using limits in eager loads that involve has_many and has_and_belongs_to_many associations |
|---|
| 725 |
|
|---|
| 726 |
|
|---|
| 727 |
*1.12.0* (October 16th, 2005) |
|---|
| 728 |
|
|---|
| 729 |
* Update/clean up documentation (rdoc) |
|---|
| 730 |
|
|---|
| 731 |
* 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>] |
|---|
| 732 |
|
|---|
| 733 |
* Change default logging colors to work on both white and black backgrounds. [Sam Stephenson] |
|---|
| 734 |
|
|---|
| 735 |
* YAML fixtures support ordered hashes for fixtures with foreign key dependencies in the same table. #1896 [purestorm@ggnore.net] |
|---|
| 736 |
|
|---|
| 737 |
* :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>] |
|---|
| 738 |
|
|---|
| 739 |
* 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. |
|---|
| 740 |
|
|---|
| 741 |
* Avoid memleak in dev mode when using fcgi |
|---|
| 742 |
|
|---|
| 743 |
* Simplified .clear on active record associations by using the existing delete_records method. #1906 [Caleb <me@cpb.ca>] |
|---|
| 744 |
|
|---|
| 745 |
* Delegate access to a customized primary key to the conventional id method. #2444. [Blair Zajac <blair@orcaware.com>] |
|---|
| 746 |
|
|---|
| 747 |
* Fix errors caused by assigning a has-one or belongs-to property to itself |
|---|
| 748 |
|
|---|
| 749 |
* Add ActiveRecord::Base.schema_format setting which specifies how databases should be dumped [Sam Stephenson] |
|---|
| 750 |
|
|---|
| 751 |
* Update DB2 adapter. #2206. [contact@maik-schmidt.de] |
|---|
| 752 |
|
|---|
| 753 |
* Corrections to SQLServer native data types. #2267. [rails.20.clarry@spamgourmet.com] |
|---|
| 754 |
|
|---|
| 755 |
* Deprecated ActiveRecord::Base.threaded_connection in favor of ActiveRecord::Base.allow_concurrency. |
|---|
| 756 |
|
|---|
| 757 |
* Protect id attribute from mass assigment even when the primary key is set to something else. #2438. [Blair Zajac <blair@orcaware.com>] |
|---|
| 758 |
|
|---|
| 759 |
* Misc doc fixes (typos/grammar/etc.). #2430. [coffee2code] |
|---|
| 760 |
|
|---|
| 761 |
* Add test coverage for content_columns. #2432. [coffee2code] |
|---|
| 762 |
|
|---|
| 763 |
* Speed up for unthreaded environments. #2431. [skaes@web.de] |
|---|
| 764 |
|
|---|
| 765 |
* Optimization for Mysql selects using mysql-ruby extension greater than 2.6.3. #2426. [skaes@web.de] |
|---|
| 766 |
|
|---|
| 767 |
* Speed up the setting of table_name. #2428. [skaes@web.de] |
|---|
| 768 |
|
|---|
| 769 |
* Optimize instantiation of STI subclass records. In partial fullfilment of #1236. [skaes@web.de] |
|---|
| 770 |
|
|---|
| 771 |
* Fix typo of 'constrains' to 'contraints'. #2069. [Michael Schuerig <michael@schuerig.de>] |
|---|
| 772 |
|
|---|
| 773 |
* Optimization refactoring for add_limit_offset!. In partial fullfilment of #1236. [skaes@web.de] |
|---|
| 774 |
|
|---|
| 775 |
* Add ability to get all siblings, including the current child, with acts_as_tree. Recloses #2140. [Michael Schuerig <michael@schuerig.de>] |
|---|
| 776 |
|
|---|
| 777 |
* Add geometric type for postgresql adapter. #2233 [akaspick@gmail.com] |
|---|
| 778 |
|
|---|
| 779 |
* 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] |
|---|
| 780 |
|
|---|
| 781 |
* Add convenience predicate methods on Column class. In partial fullfilment of #1236. [skaes@web.de] |
|---|
| 782 |
|
|---|
| 783 |
* Raise errors when invalid hash keys are passed to ActiveRecord::Base.find. #2363 [Chad Fowler <chad@chadfowler.com>, Nicholas Seckar] |
|---|
| 784 |
|
|---|
| 785 |
* Added :force option to create_table that'll try to drop the table if it already exists before creating |
|---|
| 786 |
|
|---|
| 787 |
* Fix transactions so that calling return while inside a transaction will not leave an open transaction on the connection. [Nicholas Seckar] |
|---|
| 788 |
|
|---|
| 789 |
* Use foreign_key inflection uniformly. #2156 [Blair Zajac <blair@orcaware.com>] |
|---|
| 790 |
|
|---|
| 791 |
* model.association.clear should destroy associated objects if :dependent => true instead of nullifying their foreign keys. #2221 [joergd@pobox.com, ObieFernandez <obiefernandez@gmail.com>] |
|---|
| 792 |
|
|---|
| 793 |
* Returning false from before_destroy should cancel the action. #1829 [Jeremy Huffman] |
|---|
| 794 |
|
|---|
| 795 |
* Recognize PostgreSQL NOW() default as equivalent to CURRENT_TIMESTAMP or CURRENT_DATE, depending on the column's type. #2256 [mat <mat@absolight.fr>] |
|---|
| 796 |
|
|---|
| 797 |
* Extensive documentation for the abstract database adapter. #2250 [François Beausoleil <fbeausoleil@ftml.net>] |
|---|
| 798 |
|
|---|
| 799 |
* 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>] |
|---|
| 800 |
|
|---|
| 801 |
* Improve error message when nil is assigned to an attr which validates_size_of within a range. #2022 [Manuel Holtgrewe <purestorm@ggnore.net>] |
|---|
| 802 |
|
|---|
| 803 |
* Make update_attribute use the same writer method that update_attributes uses. |
|---|
| 804 |
#2237 [trevor@protocool.com] |
|---|
| 805 |
|
|---|
| 806 |
* Make migrations honor table name prefixes and suffixes. #2298 [Jakob S, Marcel Molina] |
|---|
| 807 |
|
|---|
| 808 |
* Correct and optimize PostgreSQL bytea escaping. #1745, #1837 [dave@cherryville.org, ken@miriamtech.com, bellis@deepthought.org] |
|---|
| 809 |
|
|---|
| 810 |
* Fixtures should only reset a PostgreSQL sequence if it corresponds to an integer primary key named id. #1749 [chris@chrisbrinker.com] |
|---|
| 811 |
|
|---|
| 812 |
* Standardize the interpretation of boolean columns in the Mysql and Sqlite adapters. (Use MysqlAdapter.emulate_booleans = false to disable this behavior) |
|---|
| 813 |
|
|---|
| 814 |
* Added new symbol-driven approach to activating observers with Base#observers= [DHH]. Example: |
|---|
| 815 |
|
|---|
| 816 |
ActiveRecord::Base.observers = :cacher, :garbage_collector |
|---|
| 817 |
|
|---|
| 818 |
* 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] |
|---|
| 819 |
|
|---|
| 820 |
* Wrap :conditions in parentheses to prevent problems with OR's #1871 [Jamis Buck] |
|---|
| 821 |
|
|---|
| 822 |
* Allow the postgresql adapter to work with the SchemaDumper. [Jamis Buck] |
|---|
| 823 |
|
|---|
| 824 |
* 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] |
|---|
| 825 |
|
|---|
| 826 |
* Fixed migrations for Windows when using more than 10 [David Naseby] |
|---|
| 827 |
|
|---|
| 828 |
* Fixed that the create_x method from belongs_to wouldn't save the association properly #2042 [Florian Weber] |
|---|
| 829 |
|
|---|
| 830 |
* Fixed saving a record with two unsaved belongs_to associations pointing to the same object #2023 [Tobias Luetke] |
|---|
| 831 |
|
|---|
| 832 |
* Improved migrations' behavior when the schema_info table is empty. [Nicholas Seckar] |
|---|
| 833 |
|
|---|
| 834 |
* Fixed that Observers didn't observe sub-classes #627 [Florian Weber] |
|---|
| 835 |
|
|---|
| 836 |
* Fix eager loading error messages, allow :include to specify tables using strings or symbols. Closes #2222 [Marcel Molina] |
|---|
| 837 |
|
|---|
| 838 |
* 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] |
|---|
| 839 |
|
|---|
| 840 |
* Fixed various problems with has_and_belongs_to_many when using customer finder_sql #2094 [Florian Weber] |
|---|
| 841 |
|
|---|
| 842 |
* Added better exception error when unknown column types are used with migrations #1814 [fbeausoleil@ftml.net] |
|---|
| 843 |
|
|---|
| 844 |
* Fixed "connection lost" issue with the bundled Ruby/MySQL driver (would kill the app after 8 hours of inactivity) #2163, #428 [kajism@yahoo.com] |
|---|
| 845 |
|
|---|
| 846 |
* Fixed comparison of Active Record objects so two new objects are not equal #2099 [deberg] |
|---|
| 847 |
|
|---|
| 848 |
* Fixed that the SQL Server adapter would sometimes return DBI::Timestamp objects instead of Time #2127 [Tom Ward] |
|---|
| 849 |
|
|---|
| 850 |
* Added the instance methods #root and #ancestors on acts_as_tree and fixed siblings to not include the current node #2142, #2140 [coffee2code] |
|---|
| 851 |
|
|---|
| 852 |
* 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] |
|---|
| 853 |
|
|---|
| 854 |
* 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/ |
|---|
| 855 |
|
|---|
| 856 |
* Make sure the schema_info table is created before querying the current version #1903 |
|---|
| 857 |
|
|---|
| 858 |
* Fixtures ignore table name prefix and suffix #1987 [Jakob S] |
|---|
| 859 |
|
|---|
| 860 |
* Add documentation for index_type argument to add_index method for migrations #2005 [blaine@odeo.com] |
|---|
| 861 |
|
|---|
| 862 |
* Modify read_attribute to allow a symbol argument #2024 [Ken Kunz] |
|---|
| 863 |
|
|---|
| 864 |
* Make destroy return self #1913 [sebastian.kanthak@muehlheim.de] |
|---|
| 865 |
|
|---|
| 866 |
* Fix typo in validations documentation #1938 [court3nay] |
|---|
| 867 |
|
|---|
| 868 |
* Make acts_as_list work for insert_at(1) #1966 [hensleyl@papermountain.org] |
|---|
| 869 |
|
|---|
| 870 |
* Fix typo in count_by_sql documentation #1969 [Alexey Verkhovsky] |
|---|
| 871 |
|
|---|
| 872 |
* Allow add_column and create_table to specify NOT NULL #1712 [emptysands@gmail.com] |
|---|
| 873 |
|
|---|
| 874 |
* Fix create_table so that id column is implicitly added [Rick Olson] |
|---|
| 875 |
|
|---|
| 876 |
* 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 |
|---|
| 877 |
|
|---|
| 878 |
* OCIAdapter now properly handles synonyms, which are commonly used to separate out the schema owner from the application user #1798 |
|---|
| 879 |
|
|---|
| 880 |
* Fixed the handling of camelCase columns names in Oracle #1798 |
|---|
| 881 |
|
|---|
| 882 |
* 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 |
|---|
| 883 |
|
|---|
| 884 |
* Fixed the handling of multiple blob columns in Oracle if one or more of them are null #1798 |
|---|
| 885 |
|
|---|
| 886 |
* Added support for calling constrained class methods on has_many and has_and_belongs_to_many collections #1764 [Tobias Luetke] |
|---|
| 887 |
|
|---|
| 888 |
class Comment < AR:B |
|---|
| 889 |
def self.search(q) |
|---|
| 890 |
find(:all, :conditions => ["body = ?", q]) |
|---|
| 891 |
end |
|---|
| 892 |
end |
|---|
| 893 |
|
|---|
| 894 |
class Post < AR:B |
|---|
| 895 |
has_many :comments |
|---|
| 896 |
end |
|---|
| 897 |
|
|---|
| 898 |
Post.find(1).comments.search('hi') # => SELECT * from comments WHERE post_id = 1 AND body = 'hi' |
|---|
| 899 |
|
|---|
| 900 |
NOTICE: This patch changes the underlying SQL generated by has_and_belongs_to_many queries. If your relying on that, such as |
|---|
| 901 |
by explicitly referencing the old t and j aliases, you'll need to update your code. Of course, you _shouldn't_ be relying on |
|---|
| 902 |
details like that no less than you should be diving in to touch private variables. But just in case you do, consider yourself |
|---|
| 903 |
noticed :) |
|---|
| 904 |
|
|---|
| 905 |
* Added migration support for SQLite (using temporary tables to simulate ALTER TABLE) #1771 [Sam Stephenson] |
|---|
| 906 |
|
|---|
| 907 |
* Remove extra definition of supports_migrations? from abstract_adaptor.rb [Nicholas Seckar] |
|---|
| 908 |
|
|---|
| 909 |
* Fix acts_as_list so that moving next-to-last item to the bottom does not result in duplicate item positions |
|---|
| 910 |
|
|---|
| 911 |
* Fixed incompatibility in DB2 adapter with the new limit/offset approach #1718 [Maik Schmidt] |
|---|
| 912 |
|
|---|
| 913 |
* 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] |
|---|
| 914 |
|
|---|
| 915 |
|
|---|
| 916 |
*1.11.1* (11 July, 2005) |
|---|
| 917 |
|
|---|
| 918 |
* 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] |
|---|
| 919 |
|
|---|
| 920 |
* 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] |
|---|
| 921 |
|
|---|
| 922 |
* 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] |
|---|
| 923 |
|
|---|
| 924 |
* Correct reflected table name for singular associations. #1688 [court3nay@gmail.com] |
|---|
| 925 |
|
|---|
| 926 |
* Fixed optimistic locking with SQL Server #1660 [tom@popdog.net] |
|---|
| 927 |
|
|---|
| 928 |
* Added ActiveRecord::Migrator.migrate that can figure out whether to go up or down based on the target version and the current |
|---|
| 929 |
|
|---|
| 930 |
* Added better error message for "packets out of order" #1630 [courtenay] |
|---|
| 931 |
|
|---|
| 932 |
* Fixed first run of "rake migrate" on PostgreSQL by not expecting a return value on the id #1640 |
|---|
| 933 |
|
|---|
| 934 |
|
|---|
| 935 |
*1.11.0* (6 July, 2005) |
|---|
| 936 |
|
|---|
| 937 |
* Fixed that Yaml error message in fixtures hid the real error #1623 [Nicholas Seckar] |
|---|
| 938 |
|
|---|
| 939 |
* Changed logging of SQL statements to use the DEBUG level instead of INFO |
|---|
| 940 |
|
|---|
| 941 |
* 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. |
|---|
| 942 |
|
|---|
| 943 |
* Added callback hooks to association collections #1549 [Florian Weber]. Example: |
|---|
| 944 |
|
|---|
| 945 |
class Project |
|---|
| 946 |
has_and_belongs_to_many :developers, :before_add => :evaluate_velocity |
|---|
| 947 |
|
|---|
| 948 |
def evaluate_velocity(developer) |
|---|
| 949 |
... |
|---|
| 950 |
end |
|---|
| 951 |
end |
|---|
| 952 |
|
|---|
| 953 |
..raising an exception will cause the object not to be added (or removed, with before_remove). |
|---|
| 954 |
|
|---|
| 955 |
|
|---|
| 956 |
* Fixed Base.content_columns call for SQL Server adapter #1450 [DeLynn Berry] |
|---|
| 957 |
|
|---|
| 958 |
* Fixed Base#write_attribute to work with both symbols and strings #1190 [Paul Legato] |
|---|
| 959 |
|
|---|
| 960 |
* Fixed that has_and_belongs_to_many didn't respect single table inheritance types #1081 [Florian Weber] |
|---|
| 961 |
|
|---|
| 962 |
* Speed up ActiveRecord#method_missing for the common case (read_attribute). |
|---|
| 963 |
|
|---|
| 964 |
* Only notify observers on after_find and after_initialize if these methods are defined on the model. #1235 [skaes@web.de] |
|---|
| 965 |
|
|---|
| 966 |
* Fixed that single-table inheritance sub-classes couldn't be used to limit the result set with eager loading #1215 [Chris McGrath] |
|---|
| 967 |
|
|---|
| 968 |
* Fixed validates_numericality_of to work with overrided getter-method when :allow_nil is on #1316 [raidel@onemail.at] |
|---|
| 969 |
|
|---|
| 970 |
* Added roots, root, and siblings to the batch of methods added by acts_as_tree #1541 [michael@schuerig.de] |
|---|
| 971 |
|
|---|
| 972 |
* Added support for limit/offset with the MS SQL Server driver so that pagination will now work #1569 [DeLynn Berry] |
|---|
| 973 |
|
|---|
| 974 |
* Added support for ODBC connections to MS SQL Server so you can connect from a non-Windows machine #1569 [Mark Imbriaco/DeLynn Berry] |
|---|
| 975 |
|
|---|
| 976 |
* Fixed that multiparameter posts ignored attr_protected #1532 [alec+rails@veryclever.net] |
|---|
| 977 |
|
|---|
| 978 |
* Fixed problem with eager loading when using a has_and_belongs_to_many association using :association_foreign_key #1504 [flash@vanklinkenbergsoftware.nl] |
|---|
| 979 |
|
|---|
| 980 |
* 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: |
|---|
| 981 |
|
|---|
| 982 |
Developer.find :all, :joins => 'developers_projects', :conditions => 'id=developer_id AND project_id=1' |
|---|
| 983 |
|
|---|
| 984 |
...should instead be: |
|---|
| 985 |
|
|---|
| 986 |
Developer.find( |
|---|
| 987 |
:all, |
|---|
| 988 |
:joins => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id', |
|---|
| 989 |
:conditions => 'project_id=1' |
|---|
| 990 |
) |
|---|
| 991 |
|
|---|
| 992 |
* Fixed that validations didn't respecting custom setting for too_short, too_long messages #1437 [Marcel Molina] |
|---|
| 993 |
|
|---|
| 994 |
* 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] |
|---|
| 995 |
|
|---|
| 996 |
* Fixed that calling Model.find([]) returns [] and doesn't throw an exception #1379 |
|---|
| 997 |
|
|---|
| 998 |
* 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] |
|---|
| 999 |
|
|---|
| 1000 |
* 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 |
|---|
| 1001 |
|
|---|
| 1002 |
* Allow any Enumerable, not just Array, to work as bind variables #1344 [Jeremy Kemper] |
|---|
| 1003 |
|
|---|
| 1004 |
* Added actual database-changing behavior to collection assigment for has_many and has_and_belongs_to_many #1425 [Sebastian Kanthak]. |
|---|
| 1005 |
Example: |
|---|
| 1006 |
|
|---|
| 1007 |
david.projects = [Project.find(1), Project.new("name" => "ActionWebSearch")] |
|---|
| 1008 |
david.save |
|---|
| 1009 |
|
|---|
| 1010 |
If david.projects already contain the project with ID 1, this is left unchanged. Any other projects are dropped. And the new |
|---|
| 1011 |
project is saved when david.save is called. |
|---|
| 1012 |
|
|---|
| 1013 |
Also included is a way to do assignments through IDs, which is perfect for checkbox updating, so you get to do: |
|---|
| 1014 |
|
|---|
| 1015 |
david.project_ids = [1, 5, 7] |
|---|
| 1016 |
|
|---|
| 1017 |
* Corrected typo in find SQL for has_and_belongs_to_many. #1312 [ben@bensinclair.com] |
|---|
| 1018 |
|
|---|
| 1019 |
* Fixed sanitized conditions for has_many finder method. #1281 [jackc@hylesanderson.com, pragdave, Tobias Luetke] |
|---|
| 1020 |
|
|---|
| 1021 |
* 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] |
|---|
| 1022 |
|
|---|
| 1023 |
* Corrected @@configurations typo #1410 [david@ruppconsulting.com] |
|---|
| 1024 |
|
|---|
| 1025 |
* Return PostgreSQL columns in the order they were declared #1374 [perlguy@gmail.com] |
|---|
| 1026 |
|
|---|
| 1027 |
* Allow before/after update hooks to work on models using optimistic locking |
|---|
| 1028 |
|
|---|
| 1029 |
* Eager loading of dependent has_one associations won't delete the association #1212 |
|---|
| 1030 |
|
|---|
| 1031 |
* 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. |
|---|
| 1032 |
|
|---|
| 1033 |
* Using transactional fixtures now causes the data to be loaded only once. |
|---|
| 1034 |
|
|---|
| 1035 |
* Added fixture accessor methods that can be used when instantiated fixtures are disabled. |
|---|
| 1036 |
|
|---|
| 1037 |
fixtures :web_sites |
|---|
| 1038 |
|
|---|
| 1039 |
def test_something |
|---|
| 1040 |
assert_equal "Ruby on Rails", web_sites(:rubyonrails).name |
|---|
| 1041 |
end |
|---|
| 1042 |
|
|---|
| 1043 |
* Added DoubleRenderError exception that'll be raised if render* is called twice #518 [Nicholas Seckar] |
|---|
| 1044 |
|
|---|
| 1045 |
* Fixed exceptions occuring after render has been called #1096 [Nicholas Seckar] |
|---|
| 1046 |
|
|---|
| 1047 |
* CHANGED: validates_presence_of now uses Errors#add_on_blank, which will make " " fail the validation where it didn't before #1309 |
|---|
| 1048 |
|
|---|
| 1049 |
* Added Errors#add_on_blank which works like Errors#add_on_empty, but uses Object#blank? instead |
|---|
| 1050 |
|
|---|
| 1051 |
* 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: |
|---|
| 1052 |
|
|---|
| 1053 |
Conditional validations such as the following are made possible: |
|---|
| 1054 |
validates_numericality_of :income, :if => :employed? |
|---|
| 1055 |
|
|---|
| 1056 |
Conditional validations can also solve the salted login generator problem: |
|---|
| 1057 |
validates_confirmation_of :password, :if => :new_password? |
|---|
| 1058 |
|
|---|
| 1059 |
Using blocks: |
|---|
| 1060 |
validates_presence_of :username, :if => Proc.new { |user| user.signup_step > 1 } |
|---|
| 1061 |
|
|---|
| 1062 |
* Fixed use of construct_finder_sql when using :join #1288 [dwlt@dwlt.net] |
|---|
| 1063 |
|
|---|
| 1064 |
* Fixed that :delete_sql in has_and_belongs_to_many associations couldn't access record properties #1299 [Rick Olson] |
|---|
| 1065 |
|
|---|
| 1066 |
* Fixed that clone would break when an aggregate had the same name as one of its attributes #1307 [Jeremy Kemper] |
|---|
| 1067 |
|
|---|
| 1068 |
* 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. |
|---|
| 1069 |
|
|---|
| 1070 |
* 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. |
|---|
| 1071 |
|
|---|
| 1072 |
* Added option for passing an array to the find_all version of the dynamic finders and have it evaluated as an IN fragment. Example: |
|---|
| 1073 |
|
|---|