activerecord 1.13.2 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- data/CHANGELOG +452 -10
- data/RUNNING_UNIT_TESTS +1 -1
- data/lib/active_record.rb +5 -2
- data/lib/active_record/acts/list.rb +1 -1
- data/lib/active_record/acts/tree.rb +29 -25
- data/lib/active_record/aggregations.rb +3 -2
- data/lib/active_record/associations.rb +783 -337
- data/lib/active_record/associations/association_collection.rb +7 -12
- data/lib/active_record/associations/association_proxy.rb +62 -24
- data/lib/active_record/associations/belongs_to_association.rb +27 -46
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +50 -0
- data/lib/active_record/associations/has_and_belongs_to_many_association.rb +38 -38
- data/lib/active_record/associations/has_many_association.rb +61 -56
- data/lib/active_record/associations/has_many_through_association.rb +144 -0
- data/lib/active_record/associations/has_one_association.rb +22 -16
- data/lib/active_record/base.rb +482 -182
- data/lib/active_record/calculations.rb +225 -0
- data/lib/active_record/callbacks.rb +7 -7
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +162 -47
- data/lib/active_record/connection_adapters/abstract/quoting.rb +1 -1
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +2 -1
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +21 -1
- data/lib/active_record/connection_adapters/abstract_adapter.rb +34 -2
- data/lib/active_record/connection_adapters/db2_adapter.rb +107 -61
- data/lib/active_record/connection_adapters/mysql_adapter.rb +29 -6
- data/lib/active_record/connection_adapters/openbase_adapter.rb +349 -0
- data/lib/active_record/connection_adapters/{oci_adapter.rb → oracle_adapter.rb} +125 -59
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +24 -21
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +47 -8
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +36 -16
- data/lib/active_record/connection_adapters/sybase_adapter.rb +684 -0
- data/lib/active_record/fixtures.rb +42 -17
- data/lib/active_record/locking.rb +36 -15
- data/lib/active_record/migration.rb +111 -8
- data/lib/active_record/observer.rb +25 -1
- data/lib/active_record/reflection.rb +103 -41
- data/lib/active_record/schema.rb +2 -2
- data/lib/active_record/schema_dumper.rb +55 -18
- data/lib/active_record/timestamp.rb +6 -6
- data/lib/active_record/validations.rb +65 -40
- data/lib/active_record/vendor/db2.rb +10 -5
- data/lib/active_record/vendor/simple.rb +693 -702
- data/lib/active_record/version.rb +2 -2
- data/rakefile +4 -4
- data/test/aaa_create_tables_test.rb +25 -6
- data/test/abstract_unit.rb +39 -1
- data/test/adapter_test.rb +31 -4
- data/test/associations_cascaded_eager_loading_test.rb +106 -0
- data/test/associations_go_eager_test.rb +85 -16
- data/test/associations_join_model_test.rb +338 -0
- data/test/associations_test.rb +129 -50
- data/test/base_test.rb +204 -49
- data/test/binary_test.rb +1 -1
- data/test/calculations_test.rb +169 -0
- data/test/callbacks_test.rb +5 -23
- data/test/class_inheritable_attributes_test.rb +1 -1
- data/test/column_alias_test.rb +1 -1
- data/test/connections/native_mysql/connection.rb +1 -0
- data/test/connections/native_openbase/connection.rb +22 -0
- data/test/connections/{native_oci → native_oracle}/connection.rb +7 -9
- data/test/connections/native_sqlite/connection.rb +1 -1
- data/test/connections/native_sqlite3/connection.rb +1 -0
- data/test/connections/native_sqlite3/in_memory_connection.rb +1 -0
- data/test/connections/native_sybase/connection.rb +24 -0
- data/test/defaults_test.rb +18 -0
- data/test/deprecated_associations_test.rb +2 -2
- data/test/deprecated_finder_test.rb +0 -6
- data/test/finder_test.rb +26 -23
- data/test/fixtures/accounts.yml +10 -0
- data/test/fixtures/author.rb +31 -6
- data/test/fixtures/author_favorites.yml +4 -0
- data/test/fixtures/categories/special_categories.yml +9 -0
- data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/test/fixtures/categories_posts.yml +4 -0
- data/test/fixtures/categorization.rb +5 -0
- data/test/fixtures/categorizations.yml +11 -0
- data/test/fixtures/category.rb +6 -0
- data/test/fixtures/company.rb +17 -5
- data/test/fixtures/company_in_module.rb +19 -5
- data/test/fixtures/db_definitions/db2.drop.sql +3 -0
- data/test/fixtures/db_definitions/db2.sql +121 -100
- data/test/fixtures/db_definitions/db22.sql +2 -2
- data/test/fixtures/db_definitions/firebird.drop.sql +4 -0
- data/test/fixtures/db_definitions/firebird.sql +26 -0
- data/test/fixtures/db_definitions/mysql.drop.sql +3 -0
- data/test/fixtures/db_definitions/mysql.sql +21 -1
- data/test/fixtures/db_definitions/openbase.drop.sql +2 -0
- data/test/fixtures/db_definitions/openbase.sql +282 -0
- data/test/fixtures/db_definitions/openbase2.drop.sql +2 -0
- data/test/fixtures/db_definitions/openbase2.sql +7 -0
- data/test/fixtures/db_definitions/{oci.drop.sql → oracle.drop.sql} +6 -0
- data/test/fixtures/db_definitions/{oci.sql → oracle.sql} +25 -4
- data/test/fixtures/db_definitions/{oci2.drop.sql → oracle2.drop.sql} +0 -0
- data/test/fixtures/db_definitions/{oci2.sql → oracle2.sql} +0 -0
- data/test/fixtures/db_definitions/postgresql.drop.sql +4 -0
- data/test/fixtures/db_definitions/postgresql.sql +22 -1
- data/test/fixtures/db_definitions/schema.rb +32 -0
- data/test/fixtures/db_definitions/sqlite.drop.sql +3 -0
- data/test/fixtures/db_definitions/sqlite.sql +18 -0
- data/test/fixtures/db_definitions/sqlserver.drop.sql +3 -0
- data/test/fixtures/db_definitions/sqlserver.sql +23 -3
- data/test/fixtures/db_definitions/sybase.drop.sql +31 -0
- data/test/fixtures/db_definitions/sybase.sql +204 -0
- data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
- data/test/fixtures/db_definitions/sybase2.sql +5 -0
- data/test/fixtures/developers.yml +6 -1
- data/test/fixtures/developers_projects.yml +4 -0
- data/test/fixtures/funny_jokes.yml +14 -0
- data/test/fixtures/joke.rb +6 -0
- data/test/fixtures/legacy_thing.rb +3 -0
- data/test/fixtures/legacy_things.yml +3 -0
- data/test/fixtures/mixin.rb +1 -1
- data/test/fixtures/person.rb +4 -1
- data/test/fixtures/post.rb +26 -1
- data/test/fixtures/project.rb +1 -0
- data/test/fixtures/reader.rb +4 -0
- data/test/fixtures/readers.yml +4 -0
- data/test/fixtures/reply.rb +2 -1
- data/test/fixtures/tag.rb +5 -0
- data/test/fixtures/tagging.rb +6 -0
- data/test/fixtures/taggings.yml +18 -0
- data/test/fixtures/tags.yml +7 -0
- data/test/fixtures/tasks.yml +2 -2
- data/test/fixtures/topic.rb +2 -2
- data/test/fixtures/topics.yml +1 -0
- data/test/fixtures_test.rb +47 -13
- data/test/inheritance_test.rb +2 -2
- data/test/locking_test.rb +15 -1
- data/test/method_scoping_test.rb +248 -13
- data/test/migration_test.rb +68 -11
- data/test/mixin_nested_set_test.rb +1 -1
- data/test/modules_test.rb +6 -1
- data/test/readonly_test.rb +1 -1
- data/test/reflection_test.rb +63 -9
- data/test/schema_dumper_test.rb +41 -0
- data/test/{synonym_test_oci.rb → synonym_test_oracle.rb} +1 -1
- data/test/threaded_connections_test.rb +10 -0
- data/test/unconnected_test.rb +12 -5
- data/test/validations_test.rb +197 -10
- metadata +295 -260
- data/test/fixtures/db_definitions/create_oracle_db.bat +0 -0
- data/test/fixtures/db_definitions/create_oracle_db.sh +0 -0
- data/test/fixtures/fixture_database.sqlite +0 -0
- data/test/fixtures/fixture_database_2.sqlite +0 -0
data/CHANGELOG
CHANGED
@@ -1,13 +1,442 @@
|
|
1
|
-
*
|
1
|
+
*1.14.0* (March 27th, 2005)
|
2
|
+
|
3
|
+
* Replace 'rescue Object' with a finer grained rescue. Closes #4431. [Nicholas Seckar]
|
4
|
+
|
5
|
+
* Fixed eager loading so that an aliased table cannot clash with a has_and_belongs_to_many join table [Rick]
|
6
|
+
|
7
|
+
* Add support for :include to with_scope [andrew@redlinesoftware.com]
|
8
|
+
|
9
|
+
* Support the use of public synonyms with the Oracle adapter; required ruby-oci8 v0.1.14 #4390 [schoenm@earthlink.net]
|
10
|
+
|
11
|
+
* Change periods (.) in table aliases to _'s. Closes #4251 [jeff@ministrycentered.com]
|
12
|
+
|
13
|
+
* Changed has_and_belongs_to_many join to INNER JOIN for Mysql 3.23.x. Closes #4348 [Rick]
|
14
|
+
|
15
|
+
* Fixed issue that kept :select options from being scoped [Rick]
|
16
|
+
|
17
|
+
* Fixed db_schema_import when binary types are present #3101 [DHH]
|
18
|
+
|
19
|
+
* Fixed that MySQL enums should always be returned as strings #3501 [DHH]
|
20
|
+
|
21
|
+
* Change has_many :through to use the :source option to specify the source association. :class_name is now ignored. [Rick Olson]
|
22
|
+
|
23
|
+
class Connection < ActiveRecord::Base
|
24
|
+
belongs_to :user
|
25
|
+
belongs_to :channel
|
26
|
+
end
|
27
|
+
|
28
|
+
class Channel < ActiveRecord::Base
|
29
|
+
has_many :connections
|
30
|
+
has_many :contacts, :through => :connections, :class_name => 'User' # OLD
|
31
|
+
has_many :contacts, :through => :connections, :source => :user # NEW
|
32
|
+
end
|
33
|
+
|
34
|
+
* 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]
|
35
|
+
|
36
|
+
* Allow overriding of find parameters in scoped has_many :through calls [Rick Olson]
|
37
|
+
|
38
|
+
In this example, :include => false disables the default eager association from loading. :select changes the standard
|
39
|
+
select clause. :joins specifies a join that is added to the end of the has_many :through query.
|
40
|
+
|
41
|
+
class Post < ActiveRecord::Base
|
42
|
+
has_many :tags, :through => :taggings, :include => :tagging do
|
43
|
+
def add_joins_and_select
|
44
|
+
find :all, :select => 'tags.*, authors.id as author_id', :include => false,
|
45
|
+
:joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
* 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]
|
51
|
+
|
52
|
+
* Don't classify the has_one class when eager loading, it is already singular. Add tests. (closes #4117) [jonathan@bluewire.net.nz]
|
53
|
+
|
54
|
+
* Quit ignoring default :include options in has_many :through calls [Mark James]
|
55
|
+
|
56
|
+
* Allow has_many :through associations to find the source association by setting a custom class (closes #4307) [jonathan@bluewire.net.nz]
|
57
|
+
|
58
|
+
* Eager Loading support added for has_many :through => :has_many associations (see below). [Rick Olson]
|
59
|
+
|
60
|
+
* Allow has_many :through to work on has_many associations (closes #3864) [sco@scottraymond.net] Example:
|
61
|
+
|
62
|
+
class Firm < ActiveRecord::Base
|
63
|
+
has_many :clients
|
64
|
+
has_many :invoices, :through => :clients
|
65
|
+
end
|
66
|
+
|
67
|
+
class Client < ActiveRecord::Base
|
68
|
+
belongs_to :firm
|
69
|
+
has_many :invoices
|
70
|
+
end
|
71
|
+
|
72
|
+
class Invoice < ActiveRecord::Base
|
73
|
+
belongs_to :client
|
74
|
+
end
|
75
|
+
|
76
|
+
* Raise error when trying to select many polymorphic objects with has_many :through or :include (closes #4226) [josh@hasmanythrough.com]
|
77
|
+
|
78
|
+
* Fixed has_many :through to include :conditions set on the :through association. closes #4020 [jonathan@bluewire.net.nz]
|
79
|
+
|
80
|
+
* 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]
|
81
|
+
|
82
|
+
* SQL Server adapter gets some love #4298 [rtomayko@gmail.com]
|
83
|
+
|
84
|
+
* 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]
|
85
|
+
|
86
|
+
* 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):
|
87
|
+
|
88
|
+
Author.find(:all, :include => { :posts => :special_comments }, :order => 'special_comments.body')
|
89
|
+
|
90
|
+
* Add AbstractAdapter#table_alias_for to create table aliases according to the rules of the current adapter. [Rick]
|
91
|
+
|
92
|
+
* Provide access to the underlying database connection through Adapter#raw_connection. Enables the use of db-specific methods without complicating the adapters. #2090 [Koz]
|
93
|
+
|
94
|
+
* Remove broken attempts at handling columns with a default of 'now()' in the postgresql adapter. #2257 [Koz]
|
95
|
+
|
96
|
+
* 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]
|
97
|
+
|
98
|
+
* Fixed that Migration#execute would have the table name prefix appended to its query #4110 [mark.imbriaco@pobox.com]
|
99
|
+
|
100
|
+
* Make all tinyint(1) variants act like boolean in mysql (tinyint(1) unsigned, etc.) [Jamis Buck]
|
101
|
+
|
102
|
+
* Use association's :conditions when eager loading. [jeremyevans0@gmail.com] #4144
|
103
|
+
|
104
|
+
* Alias the has_and_belongs_to_many join table on eager includes. #4106 [jeremyevans0@gmail.com]
|
105
|
+
|
106
|
+
This statement would normally error because the projects_developers table is joined twice, and therefore joined_on would be ambiguous.
|
107
|
+
|
108
|
+
Developer.find(:all, :include => {:projects => :developers}, :conditions => 'join_project_developers.joined_on IS NOT NULL')
|
109
|
+
|
110
|
+
* Oracle adapter gets some love #4230 [schoenm@earthlink.net]
|
111
|
+
|
112
|
+
* Changes :text to CLOB rather than BLOB [Moses Hohman]
|
113
|
+
* Fixes an issue with nil numeric length/scales (several)
|
114
|
+
* Implements support for XMLTYPE columns [wilig / Kubo Takehiro]
|
115
|
+
* Tweaks a unit test to get it all green again
|
116
|
+
* Adds support for #current_database
|
117
|
+
|
118
|
+
* Added Base.abstract_class? that marks which classes are not part of the Active Record hierarchy #3704 [Rick Olson]
|
119
|
+
|
120
|
+
class CachedModel < ActiveRecord::Base
|
121
|
+
self.abstract_class = true
|
122
|
+
end
|
123
|
+
|
124
|
+
class Post < CachedModel
|
125
|
+
end
|
126
|
+
|
127
|
+
CachedModel.abstract_class?
|
128
|
+
=> true
|
129
|
+
|
130
|
+
Post.abstract_class?
|
131
|
+
=> false
|
132
|
+
|
133
|
+
Post.base_class
|
134
|
+
=> Post
|
135
|
+
|
136
|
+
Post.table_name
|
137
|
+
=> 'posts'
|
138
|
+
|
139
|
+
* Allow :dependent options to be used with polymorphic joins. #3820 [Rick Olson]
|
140
|
+
|
141
|
+
class Foo < ActiveRecord::Base
|
142
|
+
has_many :attachments, :as => :attachable, :dependent => :delete_all
|
143
|
+
end
|
144
|
+
|
145
|
+
* Nicer error message on has_many :through when :through reflection can not be found. #4042 [court3nay@gmail.com]
|
146
|
+
|
147
|
+
* Upgrade to Transaction::Simple 1.3 [Jamis Buck]
|
148
|
+
|
149
|
+
* Catch FixtureClassNotFound when using instantiated fixtures on a fixture that has no ActiveRecord model [Rick Olson]
|
150
|
+
|
151
|
+
* Allow ordering of calculated results and/or grouped fields in calculations [solo@gatelys.com]
|
152
|
+
|
153
|
+
* Make ActiveRecord::Base#save! return true instead of nil on success. #4173 [johan@johansorensen.com]
|
154
|
+
|
155
|
+
* Dynamically set allow_concurrency. #4044 [Stefan Kaes]
|
156
|
+
|
157
|
+
* Added Base#to_xml that'll turn the current record into a XML representation [DHH]. Example:
|
158
|
+
|
159
|
+
topic.to_xml
|
160
|
+
|
161
|
+
...returns:
|
162
|
+
|
163
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
164
|
+
<topic>
|
165
|
+
<title>The First Topic</title>
|
166
|
+
<author-name>David</author-name>
|
167
|
+
<id type="integer">1</id>
|
168
|
+
<approved type="boolean">false</approved>
|
169
|
+
<replies-count type="integer">0</replies-count>
|
170
|
+
<bonus-time type="datetime">2000-01-01 08:28:00</bonus-time>
|
171
|
+
<written-on type="datetime">2003-07-16 09:28:00</written-on>
|
172
|
+
<content>Have a nice day</content>
|
173
|
+
<author-email-address>david@loudthinking.com</author-email-address>
|
174
|
+
<parent-id></parent-id>
|
175
|
+
<last-read type="date">2004-04-15</last-read>
|
176
|
+
</topic>
|
177
|
+
|
178
|
+
...and you can configure with:
|
179
|
+
|
180
|
+
topic.to_xml(:skip_instruct => true, :skip_attributes => [ :id, bonus_time, :written_on, replies_count ])
|
181
|
+
|
182
|
+
...that'll return:
|
183
|
+
|
184
|
+
<topic>
|
185
|
+
<title>The First Topic</title>
|
186
|
+
<author-name>David</author-name>
|
187
|
+
<approved type="boolean">false</approved>
|
188
|
+
<content>Have a nice day</content>
|
189
|
+
<author-email-address>david@loudthinking.com</author-email-address>
|
190
|
+
<parent-id></parent-id>
|
191
|
+
<last-read type="date">2004-04-15</last-read>
|
192
|
+
</topic>
|
193
|
+
|
194
|
+
You can even do load first-level associations as part of the document:
|
195
|
+
|
196
|
+
firm.to_xml :include => [ :account, :clients ]
|
197
|
+
|
198
|
+
...that'll return something like:
|
199
|
+
|
200
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
201
|
+
<firm>
|
202
|
+
<id type="integer">1</id>
|
203
|
+
<rating type="integer">1</rating>
|
204
|
+
<name>37signals</name>
|
205
|
+
<clients>
|
206
|
+
<client>
|
207
|
+
<rating type="integer">1</rating>
|
208
|
+
<name>Summit</name>
|
209
|
+
</client>
|
210
|
+
<client>
|
211
|
+
<rating type="integer">1</rating>
|
212
|
+
<name>Microsoft</name>
|
213
|
+
</client>
|
214
|
+
</clients>
|
215
|
+
<account>
|
216
|
+
<id type="integer">1</id>
|
217
|
+
<credit-limit type="integer">50</credit-limit>
|
218
|
+
</account>
|
219
|
+
</firm>
|
220
|
+
|
221
|
+
* Allow :counter_cache to take a column name for custom counter cache columns [Jamis Buck]
|
222
|
+
|
223
|
+
* Documentation fixes for :dependent [robby@planetargon.com]
|
224
|
+
|
225
|
+
* Stop the MySQL adapter crashing when views are present. #3782 [Jonathan Viney]
|
226
|
+
|
227
|
+
* Don't classify the belongs_to class, it is already singular #4117 [keithm@infused.org]
|
228
|
+
|
229
|
+
* 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]
|
230
|
+
|
231
|
+
* Fix quoting of inheritance column for STI eager loading #4098 [Jonathan Viney <jonathan@bluewire.net.nz>]
|
232
|
+
|
233
|
+
* Added smarter table aliasing for eager associations for multiple self joins #3580 [Rick Olson]
|
234
|
+
|
235
|
+
* The first time a table is referenced in a join, no alias is used.
|
236
|
+
* After that, the parent class name and the reflection name are used.
|
237
|
+
|
238
|
+
Tree.find(:all, :include => :children) # LEFT OUTER JOIN trees AS tree_children ...
|
239
|
+
|
240
|
+
* Any additional join references get a numerical suffix like '_2', '_3', etc.
|
241
|
+
|
242
|
+
* 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.
|
243
|
+
|
244
|
+
* 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:
|
245
|
+
|
246
|
+
# cascaded in two levels
|
247
|
+
>> Author.find(:all, :include=>{:posts=>:comments})
|
248
|
+
=> authors
|
249
|
+
+- posts
|
250
|
+
+- comments
|
251
|
+
|
252
|
+
# cascaded in two levels and normal association
|
253
|
+
>> Author.find(:all, :include=>[{:posts=>:comments}, :categorizations])
|
254
|
+
=> authors
|
255
|
+
+- posts
|
256
|
+
+- comments
|
257
|
+
+- categorizations
|
258
|
+
|
259
|
+
# cascaded in two levels with two has_many associations
|
260
|
+
>> Author.find(:all, :include=>{:posts=>[:comments, :categorizations]})
|
261
|
+
=> authors
|
262
|
+
+- posts
|
263
|
+
+- comments
|
264
|
+
+- categorizations
|
265
|
+
|
266
|
+
# cascaded in three levels
|
267
|
+
>> Company.find(:all, :include=>{:groups=>{:members=>{:favorites}}})
|
268
|
+
=> companies
|
269
|
+
+- groups
|
270
|
+
+- members
|
271
|
+
+- favorites
|
272
|
+
|
273
|
+
* Make counter cache work when replacing an association #3245 [eugenol@gmail.com]
|
274
|
+
|
275
|
+
* Make migrations verbose [Jamis Buck]
|
276
|
+
|
277
|
+
* Make counter_cache work with polymorphic belongs_to [Jamis Buck]
|
278
|
+
|
279
|
+
* Fixed that calling HasOneProxy#build_model repeatedly would cause saving to happen #4058 [anna@wota.jp]
|
280
|
+
|
281
|
+
* 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:
|
282
|
+
|
283
|
+
* Does not support DATE SQL column types; use DATETIME instead.
|
284
|
+
* Date columns on HABTM join tables are returned as String, not Time.
|
285
|
+
* Insertions are potentially broken for :polymorphic join tables
|
286
|
+
* BLOB column access not yet fully supported
|
287
|
+
|
288
|
+
* Clear stale, cached connections left behind by defunct threads. [Jeremy Kemper]
|
289
|
+
|
290
|
+
* CHANGED DEFAULT: set ActiveRecord::Base.allow_concurrency to false. Most AR usage is in single-threaded applications. [Jeremy Kemper]
|
291
|
+
|
292
|
+
* Renamed the "oci" adapter to "oracle", but kept the old name as an alias #4017 [schoenm@earthlink.net]
|
293
|
+
|
294
|
+
* 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]
|
295
|
+
|
296
|
+
* Speed up class -> connection caching and stale connection verification. #3979 [Stefan Kaes]
|
297
|
+
|
298
|
+
* Add set_fixture_class to allow the use of table name accessors with models which use set_table_name. [Kevin Clark]
|
299
|
+
|
300
|
+
* Added that fixtures to placed in subdirectories of the main fixture files are also loaded #3937 [dblack@wobblini.net]
|
301
|
+
|
302
|
+
* Define attribute query methods to avoid method_missing calls. #3677 [jonathan@bluewire.net.nz]
|
303
|
+
|
304
|
+
* 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]
|
305
|
+
|
306
|
+
* Added support for nested scopes #3407 [anna@wota.jp]. Examples:
|
307
|
+
|
308
|
+
Developer.with_scope(:find => { :conditions => "salary > 10000", :limit => 10 }) do
|
309
|
+
Developer.find(:all) # => SELECT * FROM developers WHERE (salary > 10000) LIMIT 10
|
310
|
+
|
311
|
+
# inner rule is used. (all previous parameters are ignored)
|
312
|
+
Developer.with_exclusive_scope(:find => { :conditions => "name = 'Jamis'" }) do
|
313
|
+
Developer.find(:all) # => SELECT * FROM developers WHERE (name = 'Jamis')
|
314
|
+
end
|
315
|
+
|
316
|
+
# parameters are merged
|
317
|
+
Developer.with_scope(:find => { :conditions => "name = 'Jamis'" }) do
|
318
|
+
Developer.find(:all) # => SELECT * FROM developers WHERE (( salary > 10000 ) AND ( name = 'Jamis' )) LIMIT 10
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
* Fixed db2 connection with empty user_name and auth options #3622 [phurley@gmail.com]
|
323
|
+
|
324
|
+
* Fixed validates_length_of to work on UTF-8 strings by using characters instead of bytes #3699 [Masao Mutoh]
|
325
|
+
|
326
|
+
* Fixed that reflections would bleed across class boundaries in single-table inheritance setups #3796 [lars@pind.com]
|
327
|
+
|
328
|
+
* 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:
|
329
|
+
|
330
|
+
Person.average :age
|
331
|
+
Person.minimum :age
|
332
|
+
Person.maximum :age
|
333
|
+
Person.sum :salary, :group => :last_name
|
334
|
+
|
335
|
+
* 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]
|
336
|
+
|
337
|
+
* Reflections don't attempt to resolve module nesting of association classes. Simplify type computation. [Jeremy Kemper]
|
338
|
+
|
339
|
+
* 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]
|
340
|
+
|
341
|
+
* Fixed that the schema_info table used by ActiveRecord::Schema.define should respect table pre- and suffixes #3834 [rubyonrails@atyp.de]
|
342
|
+
|
343
|
+
* 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]
|
344
|
+
|
345
|
+
* Correct syntax error in mysql DDL, and make AAACreateTablesTest run first [Bob Silva]
|
346
|
+
|
347
|
+
* Allow :include to be used with has_many :through associations #3611 [Michael Schoen]
|
348
|
+
|
349
|
+
* PostgreSQL: smarter schema dumps using pk_and_sequence_for(table). #2920 [Blair Zajac]
|
350
|
+
|
351
|
+
* SQLServer: more compatible limit/offset emulation. #3779 [Tom Ward]
|
352
|
+
|
353
|
+
* Polymorphic join support for has_one associations (has_one :foo, :as => :bar) #3785 [Rick Olson]
|
354
|
+
|
355
|
+
* PostgreSQL: correctly parse negative integer column defaults. #3776 [bellis@deepthought.org]
|
356
|
+
|
357
|
+
* Fix problems with count when used with :include [Jeremy Hopple and Kevin Clark]
|
358
|
+
|
359
|
+
* ActiveRecord::RecordInvalid now states which validations failed in its default error message [Tobias Luetke]
|
360
|
+
|
361
|
+
* Using AssociationCollection#build with arrays of hashes should call build, not create [DHH]
|
362
|
+
|
363
|
+
* Remove definition of reloadable? from ActiveRecord::Base to make way for new Reloadable code. [Nicholas Seckar]
|
364
|
+
|
365
|
+
* 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]
|
366
|
+
|
367
|
+
* Support the :column option for remove_index with the PostgreSQL adapter. #3661 [shugo@ruby-lang.org]
|
368
|
+
|
369
|
+
* Add documentation for add_index and remove_index. #3600 [Manfred Stienstra <m.stienstra@fngtps.com>]
|
370
|
+
|
371
|
+
* If the OCI library is not available, raise an exception indicating as much. #3593 [schoenm@earthlink.net]
|
372
|
+
|
373
|
+
* Add explicit :order in finder tests as postgresql orders results differently by default. #3577. [Rick Olson]
|
374
|
+
|
375
|
+
* Make dynamic finders honor additional passed in :conditions. #3569 [Oleg Pudeyev <pudeyo@rpi.edu>, Marcel Molina Jr.]
|
376
|
+
|
377
|
+
* Show a meaningful error when the DB2 adapter cannot be loaded due to missing dependencies. [Nicholas Seckar]
|
378
|
+
|
379
|
+
* Make .count work for has_many associations with multi line finder sql [schoenm@earthlink.net]
|
380
|
+
|
381
|
+
* Add AR::Base.base_class for querying the ancestor AR::Base subclass [Jamis Buck]
|
382
|
+
|
383
|
+
* Allow configuration of the column used for optimistic locking [wilsonb@gmail.com]
|
384
|
+
|
385
|
+
* Don't hardcode 'id' in acts as list. [ror@philippeapril.com]
|
386
|
+
|
387
|
+
* Fix date errors for SQLServer in association tests. #3406 [kevin.clark@gmal.com]
|
388
|
+
|
389
|
+
* Escape database name in MySQL adapter when creating and dropping databases. #3409 [anna@wota.jp]
|
390
|
+
|
391
|
+
* Disambiguate table names for columns in validates_uniquness_of's WHERE clause. #3423 [alex.borovsky@gmail.com]
|
392
|
+
|
393
|
+
* .with_scope imposed create parameters now bypass attr_protected [Tobias Luetke]
|
394
|
+
|
395
|
+
* Don't raise an exception when there are more keys than there are named bind variables when sanitizing conditions. [Marcel Molina Jr.]
|
396
|
+
|
397
|
+
* Multiple enhancements and adjustments to DB2 adaptor. #3377 [contact@maik-schmidt.de]
|
398
|
+
|
399
|
+
* Sanitize scoped conditions. [Marcel Molina Jr.]
|
400
|
+
|
401
|
+
* 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]
|
402
|
+
|
403
|
+
* 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]
|
404
|
+
|
405
|
+
* 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]
|
406
|
+
|
407
|
+
* Fixed that saving a model with multiple habtm associations would only save the first one. #3244 [yanowitz-rubyonrails@quantumfoam.org, Florian Weber]
|
408
|
+
|
409
|
+
* Fix change_column to work with PostgreSQL 7.x and 8.x. #3141 [wejn@box.cz, Rick Olson, Scott Barron]
|
410
|
+
|
411
|
+
* removed :piggyback in favor of just allowing :select on :through associations. [Tobias Luetke]
|
412
|
+
|
413
|
+
* made method missing delegation to class methods on relation target work on :through associations. [Tobias Luetke]
|
414
|
+
|
415
|
+
* made .find() work on :through relations. [Tobias Luetke]
|
416
|
+
|
417
|
+
* Fix typo in association docs. #3296. [Blair Zajac]
|
418
|
+
|
419
|
+
* Fixed :through relations when using STI inherited classes would use the inherited class's name as foreign key on the join model [Tobias Luetke]
|
420
|
+
|
2
421
|
*1.13.2* (December 13th, 2005)
|
3
422
|
|
4
423
|
* Become part of Rails 1.0
|
5
424
|
|
6
425
|
* MySQL: allow encoding option for mysql.rb driver. [Jeremy Kemper]
|
7
426
|
|
8
|
-
*
|
427
|
+
* Added option inheritance for find calls on has_and_belongs_to_many and has_many assosociations [DHH]. Example:
|
9
428
|
|
10
|
-
|
429
|
+
class Post
|
430
|
+
has_many :recent_comments, :class_name => "Comment", :limit => 10, :include => :author
|
431
|
+
end
|
432
|
+
|
433
|
+
post.recent_comments.find(:all) # Uses LIMIT 10 and includes authors
|
434
|
+
post.recent_comments.find(:all, :limit => nil) # Uses no limit but include authors
|
435
|
+
post.recent_comments.find(:all, :limit => nil, :include => nil) # Uses no limit and doesn't include authors
|
436
|
+
|
437
|
+
* Added option to specify :group, :limit, :offset, and :select options from find on has_and_belongs_to_many and has_many assosociations [DHH]
|
438
|
+
|
439
|
+
* MySQL: fixes for the bundled mysql.rb driver. #3160 [Justin Forder]
|
11
440
|
|
12
441
|
* SQLServer: fix obscure optimistic locking bug. #3068 [kajism@yahoo.com]
|
13
442
|
|
@@ -21,9 +450,6 @@
|
|
21
450
|
|
22
451
|
* Oracle: active? performs a select instead of a commit. #3133 [Michael Schoen]
|
23
452
|
|
24
|
-
|
25
|
-
*1.13.1* (December 7th, 2005)
|
26
|
-
|
27
453
|
* MySQL: more robust test for nullified result hashes. #3124 [Stefan Kaes]
|
28
454
|
|
29
455
|
* Reloading an instance refreshes its aggregations as well as its associations. #3024 [François Beausolei]
|
@@ -36,14 +462,16 @@
|
|
36
462
|
|
37
463
|
* 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]
|
38
464
|
|
39
|
-
*
|
465
|
+
* Added preliminary support for polymorphic associations [DHH]
|
466
|
+
|
467
|
+
* Added preliminary support for join models [DHH]
|
468
|
+
|
469
|
+
* Allow validate_uniqueness_of to be scoped by more than just one column. #1559. [jeremy@jthopple.com, Marcel Molina Jr.]
|
40
470
|
|
41
471
|
* Firebird: active? and reconnect! methods for handling stale connections. #428 [Ken Kunz <kennethkunz@gmail.com>]
|
42
472
|
|
43
473
|
* Firebird: updated for FireRuby 0.4.0. #3009 [Ken Kunz <kennethkunz@gmail.com>]
|
44
474
|
|
45
|
-
* 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>]
|
46
|
-
|
47
475
|
* MySQL and PostgreSQL: active? compatibility with the pure-Ruby driver. #428 [Jeremy Kemper]
|
48
476
|
|
49
477
|
* Oracle: active? check pings the database rather than testing the last command status. #428 [Michael Schoen]
|
@@ -54,6 +482,10 @@
|
|
54
482
|
|
55
483
|
* 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]
|
56
484
|
|
485
|
+
* MySQL, PostgreSQL: reconnect! also reconfigures the connection. Otherwise, the connection 'loses' its settings if it times out and is reconnected. #2978 [Shugo Maeda]
|
486
|
+
|
487
|
+
* has_and_belongs_to_many: use JOIN instead of LEFT JOIN. [Jeremy Kemper]
|
488
|
+
|
57
489
|
* 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]
|
58
490
|
|
59
491
|
* Add tasks to create, drop and rebuild the MySQL and PostgreSQL test databases. [Marcel Molina Jr.]
|
@@ -68,14 +500,24 @@
|
|
68
500
|
|
69
501
|
* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
|
70
502
|
|
503
|
+
* 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>]
|
504
|
+
|
505
|
+
* SQLServer: active? and reconnect! methods for handling stale connections. #428 [kajism@yahoo.com, Tom Ward <tom@popdog.net>]
|
506
|
+
|
507
|
+
* Associations handle case-equality more consistently: item.parts.is_a?(Array) and item.parts === Array. #1345 [MarkusQ@reality.com]
|
508
|
+
|
71
509
|
* SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY. #2866 [kajism@yahoo.com, Tom Ward <tom@popdog.net>]
|
72
510
|
|
511
|
+
* Oracle: active? and reconnect! methods for handling stale connections. Optionally retry queries after reconnect. #428 [Michael Schoen <schoenm@earthlink.net>]
|
512
|
+
|
73
513
|
* Correct documentation for Base.delete_all. #1568 [Newhydra]
|
74
514
|
|
75
515
|
* Oracle: test case for column default parsing. #2788 [Michael Schoen <schoenm@earthlink.net>]
|
76
516
|
|
77
517
|
* Update documentation for Migrations. #2861 [Tom Werner <tom@cube6media.com>]
|
78
518
|
|
519
|
+
* 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]
|
520
|
+
|
79
521
|
* Oracle: Much faster column reflection. #2848 [Michael Schoen <schoenm@earthlink.net>]
|
80
522
|
|
81
523
|
* Base.reset_sequence_name analogous to reset_table_name (mostly useful for testing). Base.define_attr_method allows nil values. [Jeremy Kemper]
|
@@ -1670,7 +2112,7 @@ in effect. Added :readonly finder constraint. Calling an association collectio
|
|
1670
2112
|
end
|
1671
2113
|
end
|
1672
2114
|
|
1673
|
-
This will add an error to the tune of "is too short (
|
2115
|
+
This will add an error to the tune of "is too short (minimum is 3 characters)" or "is too long (minimum is 20 characters)" if
|
1674
2116
|
the password is outside the boundry. The messages can be changed by passing a third and forth parameter as message strings.
|
1675
2117
|
|
1676
2118
|
* Implemented a clone method that works properly with AR. It returns a clone of the record that
|