activerecord 1.14.4 → 1.15.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 +400 -1
- data/README +2 -2
- data/RUNNING_UNIT_TESTS +21 -3
- data/Rakefile +55 -10
- data/lib/active_record.rb +10 -4
- data/lib/active_record/acts/list.rb +15 -4
- data/lib/active_record/acts/nested_set.rb +11 -12
- data/lib/active_record/acts/tree.rb +13 -14
- data/lib/active_record/aggregations.rb +46 -22
- data/lib/active_record/associations.rb +213 -162
- data/lib/active_record/associations/association_collection.rb +45 -15
- data/lib/active_record/associations/association_proxy.rb +32 -13
- data/lib/active_record/associations/has_and_belongs_to_many_association.rb +18 -18
- data/lib/active_record/associations/has_many_association.rb +37 -17
- data/lib/active_record/associations/has_many_through_association.rb +120 -30
- data/lib/active_record/associations/has_one_association.rb +1 -1
- data/lib/active_record/attribute_methods.rb +75 -0
- data/lib/active_record/base.rb +282 -203
- data/lib/active_record/calculations.rb +95 -54
- data/lib/active_record/callbacks.rb +13 -24
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +12 -1
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb.rej +21 -0
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +30 -4
- data/lib/active_record/connection_adapters/abstract/quoting.rb +16 -9
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +121 -37
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +55 -23
- data/lib/active_record/connection_adapters/abstract_adapter.rb +8 -0
- data/lib/active_record/connection_adapters/db2_adapter.rb +1 -11
- data/lib/active_record/connection_adapters/firebird_adapter.rb +364 -50
- data/lib/active_record/connection_adapters/frontbase_adapter.rb +861 -0
- data/lib/active_record/connection_adapters/mysql_adapter.rb +86 -33
- data/lib/active_record/connection_adapters/openbase_adapter.rb +4 -3
- data/lib/active_record/connection_adapters/oracle_adapter.rb +151 -127
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +125 -48
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +38 -10
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +183 -155
- data/lib/active_record/connection_adapters/sybase_adapter.rb +190 -212
- data/lib/active_record/deprecated_associations.rb +24 -10
- data/lib/active_record/deprecated_finders.rb +4 -1
- data/lib/active_record/fixtures.rb +37 -23
- data/lib/active_record/locking/optimistic.rb +106 -0
- data/lib/active_record/locking/pessimistic.rb +77 -0
- data/lib/active_record/migration.rb +8 -5
- data/lib/active_record/observer.rb +73 -34
- data/lib/active_record/reflection.rb +21 -7
- data/lib/active_record/schema_dumper.rb +33 -5
- data/lib/active_record/timestamp.rb +23 -34
- data/lib/active_record/transactions.rb +37 -30
- data/lib/active_record/validations.rb +46 -30
- data/lib/active_record/vendor/mysql.rb +20 -5
- data/lib/active_record/version.rb +2 -2
- data/lib/active_record/wrappings.rb +1 -2
- data/lib/active_record/xml_serialization.rb +308 -0
- data/test/aaa_create_tables_test.rb +5 -1
- data/test/abstract_unit.rb +18 -8
- data/test/{active_schema_mysql.rb → active_schema_test_mysql.rb} +2 -2
- data/test/adapter_test.rb +9 -7
- data/test/adapter_test_sqlserver.rb +81 -0
- data/test/aggregations_test.rb +29 -0
- data/test/{association_callbacks_test.rb → associations/callbacks_test.rb} +10 -8
- data/test/{associations_cascaded_eager_loading_test.rb → associations/cascaded_eager_loading_test.rb} +35 -3
- data/test/{associations_go_eager_test.rb → associations/eager_test.rb} +36 -2
- data/test/{associations_extensions_test.rb → associations/extension_test.rb} +5 -0
- data/test/{associations_join_model_test.rb → associations/join_model_test.rb} +118 -8
- data/test/associations_test.rb +339 -45
- data/test/attribute_methods_test.rb +49 -0
- data/test/base_test.rb +321 -67
- data/test/calculations_test.rb +48 -10
- data/test/callbacks_test.rb +13 -0
- data/test/connection_test_firebird.rb +8 -0
- data/test/connections/native_db2/connection.rb +18 -17
- data/test/connections/native_firebird/connection.rb +19 -17
- data/test/connections/native_frontbase/connection.rb +27 -0
- data/test/connections/native_mysql/connection.rb +18 -15
- data/test/connections/native_openbase/connection.rb +14 -15
- data/test/connections/native_oracle/connection.rb +16 -12
- data/test/connections/native_postgresql/connection.rb +16 -17
- data/test/connections/native_sqlite/connection.rb +3 -6
- data/test/connections/native_sqlite3/connection.rb +3 -6
- data/test/connections/native_sqlserver/connection.rb +16 -17
- data/test/connections/native_sqlserver_odbc/connection.rb +18 -19
- data/test/connections/native_sybase/connection.rb +16 -17
- data/test/datatype_test_postgresql.rb +52 -0
- data/test/defaults_test.rb +52 -10
- data/test/deprecated_associations_test.rb +151 -107
- data/test/deprecated_finder_test.rb +83 -66
- data/test/empty_date_time_test.rb +25 -0
- data/test/finder_test.rb +118 -11
- data/test/fixtures/accounts.yml +6 -1
- data/test/fixtures/author.rb +27 -4
- data/test/fixtures/categorizations.yml +8 -2
- data/test/fixtures/category.rb +1 -2
- data/test/fixtures/comments.yml +0 -6
- data/test/fixtures/companies.yml +6 -1
- data/test/fixtures/company.rb +23 -1
- data/test/fixtures/company_in_module.rb +8 -10
- data/test/fixtures/customer.rb +2 -2
- data/test/fixtures/customers.yml +9 -0
- data/test/fixtures/db_definitions/db2.drop.sql +1 -0
- data/test/fixtures/db_definitions/db2.sql +9 -0
- data/test/fixtures/db_definitions/firebird.drop.sql +3 -0
- data/test/fixtures/db_definitions/firebird.sql +13 -1
- data/test/fixtures/db_definitions/frontbase.drop.sql +31 -0
- data/test/fixtures/db_definitions/frontbase.sql +262 -0
- data/test/fixtures/db_definitions/frontbase2.drop.sql +1 -0
- data/test/fixtures/db_definitions/frontbase2.sql +4 -0
- data/test/fixtures/db_definitions/mysql.drop.sql +1 -0
- data/test/fixtures/db_definitions/mysql.sql +23 -14
- data/test/fixtures/db_definitions/openbase.sql +13 -1
- data/test/fixtures/db_definitions/oracle.drop.sql +2 -0
- data/test/fixtures/db_definitions/oracle.sql +29 -2
- data/test/fixtures/db_definitions/postgresql.drop.sql +3 -1
- data/test/fixtures/db_definitions/postgresql.sql +13 -3
- data/test/fixtures/db_definitions/schema.rb +29 -1
- data/test/fixtures/db_definitions/sqlite.drop.sql +1 -0
- data/test/fixtures/db_definitions/sqlite.sql +12 -3
- data/test/fixtures/db_definitions/sqlserver.drop.sql +3 -0
- data/test/fixtures/db_definitions/sqlserver.sql +35 -0
- data/test/fixtures/db_definitions/sybase.drop.sql +2 -0
- data/test/fixtures/db_definitions/sybase.sql +13 -4
- data/test/fixtures/developer.rb +12 -0
- data/test/fixtures/edge.rb +5 -0
- data/test/fixtures/edges.yml +6 -0
- data/test/fixtures/funny_jokes.yml +3 -7
- data/test/fixtures/migrations_with_decimal/1_give_me_big_numbers.rb +15 -0
- data/test/fixtures/migrations_with_missing_versions/1000_people_have_middle_names.rb +9 -0
- data/test/fixtures/migrations_with_missing_versions/1_people_have_last_names.rb +9 -0
- data/test/fixtures/migrations_with_missing_versions/3_we_need_reminders.rb +12 -0
- data/test/fixtures/migrations_with_missing_versions/4_innocent_jointable.rb +12 -0
- data/test/fixtures/mixin.rb +15 -0
- data/test/fixtures/mixins.yml +38 -0
- data/test/fixtures/post.rb +3 -2
- data/test/fixtures/project.rb +3 -1
- data/test/fixtures/topic.rb +6 -1
- data/test/fixtures/topics.yml +4 -4
- data/test/fixtures/vertex.rb +9 -0
- data/test/fixtures/vertices.yml +4 -0
- data/test/fixtures_test.rb +45 -0
- data/test/inheritance_test.rb +67 -6
- data/test/lifecycle_test.rb +40 -19
- data/test/locking_test.rb +170 -26
- data/test/method_scoping_test.rb +2 -2
- data/test/migration_test.rb +387 -110
- data/test/migration_test_firebird.rb +124 -0
- data/test/mixin_nested_set_test.rb +14 -2
- data/test/mixin_test.rb +56 -18
- data/test/modules_test.rb +8 -2
- data/test/multiple_db_test.rb +2 -2
- data/test/pk_test.rb +1 -0
- data/test/reflection_test.rb +8 -2
- data/test/schema_authorization_test_postgresql.rb +75 -0
- data/test/schema_dumper_test.rb +40 -4
- data/test/table_name_test_sqlserver.rb +23 -0
- data/test/threaded_connections_test.rb +19 -16
- data/test/transactions_test.rb +86 -72
- data/test/validations_test.rb +126 -56
- data/test/xml_serialization_test.rb +125 -0
- metadata +45 -11
- data/lib/active_record/locking.rb +0 -79
data/CHANGELOG
CHANGED
@@ -1,3 +1,403 @@
|
|
1
|
+
*1.15.0* (January 16th, 2007)
|
2
|
+
|
3
|
+
* [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name. #7072 [jeremymcanally]
|
4
|
+
|
5
|
+
* change_column accepts :default => nil. Skip column options for primary keys. #6956, #7048 [dcmanges, Jeremy Kemper]
|
6
|
+
|
7
|
+
* MySQL, PostgreSQL: change_column_default quotes the default value and doesn't lose column type information. #3987, #6664 [Jonathan Viney, manfred, altano@bigfoot.com]
|
8
|
+
|
9
|
+
* Oracle: create_table takes a :sequence_name option to override the 'tablename_seq' default. #7000 [Michael Schoen]
|
10
|
+
|
11
|
+
* MySQL: retain SSL settings on reconnect. #6976 [randyv2]
|
12
|
+
|
13
|
+
* SQLServer: handle [quoted] table names. #6635 [rrich]
|
14
|
+
|
15
|
+
* acts_as_nested_set works with single-table inheritance. #6030 [Josh Susser]
|
16
|
+
|
17
|
+
* PostgreSQL, Oracle: correctly perform eager finds with :limit and :order. #4668, #7021 [eventualbuddha, Michael Schoen]
|
18
|
+
|
19
|
+
* Fix the Oracle adapter for serialized attributes stored in CLOBs. Closes #6825 [mschoen, tdfowler]
|
20
|
+
|
21
|
+
* [DOCS] Apply more documentation for ActiveRecord Reflection. Closes #4055 [Robby Russell]
|
22
|
+
|
23
|
+
* [DOCS] Document :allow_nil option of #validate_uniqueness_of. Closes #3143 [Caio Chassot]
|
24
|
+
|
25
|
+
* Bring the sybase adapter up to scratch for 1.2 release. [jsheets]
|
26
|
+
|
27
|
+
* Oracle: fix connection reset failure. #6846 [leonlleslie]
|
28
|
+
|
29
|
+
* Subclass instantiation doesn't try to explicitly require the corresponding subclass. #6840 [leei, Jeremy Kemper]
|
30
|
+
|
31
|
+
* fix faulty inheritance tests and that eager loading grabs the wrong inheritance column when the class of your association is an STI subclass. Closes #6859 [protocool]
|
32
|
+
|
33
|
+
* find supports :lock with :include. Check whether your database allows SELECT ... FOR UPDATE with outer joins before using. #6764 [vitaly, Jeremy Kemper]
|
34
|
+
|
35
|
+
* Support nil and Array in :conditions => { attr => value } hashes. #6548 [Assaf, Jeremy Kemper]
|
36
|
+
find(:all, :conditions => { :topic_id => [1, 2, 3], :last_read => nil }
|
37
|
+
|
38
|
+
* Quote ActiveSupport::Multibyte::Chars. #6653 [Julian Tarkhanov]
|
39
|
+
|
40
|
+
* MySQL: detect when a NOT NULL column without a default value is misreported as default ''. Can't detect for string, text, and binary columns since '' is a legitimate default. #6156 [simon@redhillconsulting.com.au, obrie, Jonathan Viney, Jeremy Kemper]
|
41
|
+
|
42
|
+
* validates_numericality_of uses \A \Z to ensure the entire string matches rather than ^ $ which may match one valid line of a multiline string. #5716 [Andreas Schwarz]
|
43
|
+
|
44
|
+
* Oracle: automatically detect the primary key. #6594 [vesaria, Michael Schoen]
|
45
|
+
|
46
|
+
* Oracle: to increase performance, prefetch 100 rows and enable similar cursor sharing. Both are configurable in database.yml. #6607 [philbogle@gmail.com, ray.fortna@jobster.com, Michael Schoen]
|
47
|
+
|
48
|
+
* Firebird: decimal/numeric support. #6408 [macrnic]
|
49
|
+
|
50
|
+
* Find with :include respects scoped :order. #5850
|
51
|
+
|
52
|
+
* Dynamically generate reader methods for serialized attributes. #6362 [Stefan Kaes]
|
53
|
+
|
54
|
+
* Deprecation: object transactions warning. [Jeremy Kemper]
|
55
|
+
|
56
|
+
* has_one :dependent => :nullify ignores nil associates. #6528 [janovetz, Jeremy Kemper]
|
57
|
+
|
58
|
+
* Oracle: resolve test failures, use prefetched primary key for inserts, check for null defaults, fix limited id selection for eager loading. Factor out some common methods from all adapters. #6515 [Michael Schoen]
|
59
|
+
|
60
|
+
* Make add_column use the options hash with the Sqlite Adapter. Closes #6464 [obrie]
|
61
|
+
|
62
|
+
* Document other options available to migration's add_column. #6419 [grg]
|
63
|
+
|
64
|
+
* MySQL: all_hashes compatibility with old MysqlRes class. #6429, #6601 [Jeremy Kemper]
|
65
|
+
|
66
|
+
* Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes #5783. [Jonathan Viney]
|
67
|
+
|
68
|
+
* fix select_limited_ids_list issues in postgresql, retain current behavior in other adapters [Rick]
|
69
|
+
|
70
|
+
* Restore eager condition interpolation, document it's differences [Rick]
|
71
|
+
|
72
|
+
* Don't rollback in teardown unless a transaction was started. Don't start a transaction in create_fixtures if a transaction is started. #6282 [Jacob Fugal, Jeremy Kemper]
|
73
|
+
|
74
|
+
* Add #delete support to has_many :through associations. Closes #6049 [Martin Landers]
|
75
|
+
|
76
|
+
* Reverted old select_limited_ids_list postgresql fix that caused issues in mysql. Closes #5851 [Rick]
|
77
|
+
|
78
|
+
* Removes the ability for eager loaded conditions to be interpolated, since there is no model instance to use as a context for interpolation. #5553 [turnip@turnipspatch.com]
|
79
|
+
|
80
|
+
* Added timeout option to SQLite3 configurations to deal more gracefully with SQLite3::BusyException, now the connection can instead retry for x seconds to see if the db clears up before throwing that exception #6126 [wreese@gmail.com]
|
81
|
+
|
82
|
+
* Added update_attributes! which uses save! to raise an exception if a validation error prevents saving #6192 [jonathan]
|
83
|
+
|
84
|
+
* Deprecated add_on_boundary_breaking (use validates_length_of instead) #6292 [BobSilva]
|
85
|
+
|
86
|
+
* The has_many create method works with polymorphic associations. #6361 [Dan Peterson]
|
87
|
+
|
88
|
+
* MySQL: introduce Mysql::Result#all_hashes to support further optimization. #5581 [Stefan Kaes]
|
89
|
+
|
90
|
+
* save! shouldn't validate twice. #6324 [maiha, Bob Silva]
|
91
|
+
|
92
|
+
* Association collections have an _ids reader method to match the existing writer for collection_select convenience (e.g. employee.task_ids). The writer method skips blank ids so you can safely do @employee.task_ids = params[:tasks] without checking every time for an empty list or blank values. #1887, #5780 [Michael Schuerig]
|
93
|
+
|
94
|
+
* Add an attribute reader method for ActiveRecord::Base.observers [Rick Olson]
|
95
|
+
|
96
|
+
* Deprecation: count class method should be called with an options hash rather than two args for conditions and joins. #6287 [Bob Silva]
|
97
|
+
|
98
|
+
* has_one associations with a nil target may be safely marshaled. #6279 [norbauer, Jeremy Kemper]
|
99
|
+
|
100
|
+
* Duplicate the hash provided to AR::Base#to_xml to prevent unexpected side effects [Koz]
|
101
|
+
|
102
|
+
* Add a :namespace option to AR::Base#to_xml [Koz]
|
103
|
+
|
104
|
+
* Deprecation tests. Remove warnings for dynamic finders and for the foo_count method if it's also an attribute. [Jeremy Kemper]
|
105
|
+
|
106
|
+
* Mock Time.now for more accurate Touch mixin tests. #6213 [Dan Peterson]
|
107
|
+
|
108
|
+
* Improve yaml fixtures error reporting. #6205 [Bruce Williams]
|
109
|
+
|
110
|
+
* Rename AR::Base#quote so people can use that name in their models. #3628 [Koz]
|
111
|
+
|
112
|
+
* Add deprecation warning for inferred foreign key. #6029 [Josh Susser]
|
113
|
+
|
114
|
+
* Fixed the Ruby/MySQL adapter we ship with Active Record to work with the new authentication handshake that was introduced in MySQL 4.1, along with the other protocol changes made at that time #5723 [jimw@mysql.com]
|
115
|
+
|
116
|
+
* Deprecation: use :dependent => :delete_all rather than :exclusively_dependent => true. #6024 [Josh Susser]
|
117
|
+
|
118
|
+
* Optimistic locking: gracefully handle nil versions, treat as zero. #5908 [Tom Ward]
|
119
|
+
|
120
|
+
* to_xml: the :methods option works on arrays of records. #5845 [Josh Starcher]
|
121
|
+
|
122
|
+
* has_many :through conditions are sanitized by the associating class. #5971 [martin.emde@gmail.com]
|
123
|
+
|
124
|
+
* Fix spurious newlines and spaces in AR::Base#to_xml output [Jamis Buck]
|
125
|
+
|
126
|
+
* has_one supports the :dependent => :delete option which skips the typical callback chain and deletes the associated object directly from the database. #5927 [Chris Mear, Jonathan Viney]
|
127
|
+
|
128
|
+
* Nested subclasses are not prefixed with the parent class' table_name since they should always use the base class' table_name. #5911 [Jonathan Viney]
|
129
|
+
|
130
|
+
* SQLServer: work around bug where some unambiguous date formats are not correctly identified if the session language is set to german. #5894 [Tom Ward, kruth@bfpi]
|
131
|
+
|
132
|
+
* Clashing type columns due to a sloppy join shouldn't wreck single-table inheritance. #5838 [Kevin Clark]
|
133
|
+
|
134
|
+
* Fixtures: correct escaping of \n and \r. #5859 [evgeny.zislis@gmail.com]
|
135
|
+
|
136
|
+
* Migrations: gracefully handle missing migration files. #5857 [eli.gordon@gmail.com]
|
137
|
+
|
138
|
+
* MySQL: update test schema for MySQL 5 strict mode. #5861 [Tom Ward]
|
139
|
+
|
140
|
+
* to_xml: correct naming of included associations. #5831 [josh.starcher@gmail.com]
|
141
|
+
|
142
|
+
* Pushing a record onto a has_many :through sets the association's foreign key to the associate's primary key and adds it to the correct association. #5815, #5829 [josh@hasmanythrough.com]
|
143
|
+
|
144
|
+
* Add records to has_many :through using <<, push, and concat by creating the association record. Raise if base or associate are new records since both ids are required to create the association. #build raises since you can't associate an unsaved record. #create! takes an attributes hash and creates the associated record and its association in a transaction. [Jeremy Kemper]
|
145
|
+
|
146
|
+
# Create a tagging to associate the post and tag.
|
147
|
+
post.tags << Tag.find_by_name('old')
|
148
|
+
post.tags.create! :name => 'general'
|
149
|
+
|
150
|
+
# Would have been:
|
151
|
+
post.taggings.create!(:tag => Tag.find_by_name('finally')
|
152
|
+
transaction do
|
153
|
+
post.taggings.create!(:tag => Tag.create!(:name => 'general'))
|
154
|
+
end
|
155
|
+
|
156
|
+
* Cache nil results for :included has_one associations also. #5787 [Michael Schoen]
|
157
|
+
|
158
|
+
* Fixed a bug which would cause .save to fail after trying to access a empty has_one association on a unsaved record. [Tobias Luetke]
|
159
|
+
|
160
|
+
* Nested classes are given table names prefixed by the singular form of the parent's table name. [Jeremy Kemper]
|
161
|
+
Example: Invoice::Lineitem is given table name invoice_lineitems
|
162
|
+
|
163
|
+
* Migrations: uniquely name multicolumn indexes so you don't have to. [Jeremy Kemper]
|
164
|
+
# people_active_last_name_index, people_active_deactivated_at_index
|
165
|
+
add_index :people, [:active, :last_name]
|
166
|
+
add_index :people, [:active, :deactivated_at]
|
167
|
+
remove_index :people, [:active, :last_name]
|
168
|
+
remove_index :people, [:active, :deactivated_at]
|
169
|
+
|
170
|
+
WARNING: backward-incompatibility. Multicolumn indexes created before this
|
171
|
+
revision were named using the first column name only. Now they're uniquely
|
172
|
+
named using all indexed columns.
|
173
|
+
|
174
|
+
To remove an old multicolumn index, remove_index :table_name, :first_column
|
175
|
+
|
176
|
+
* Fix for deep includes on the same association. [richcollins@gmail.com]
|
177
|
+
|
178
|
+
* Tweak fixtures so they don't try to use a non-ActiveRecord class. [Kevin Clark]
|
179
|
+
|
180
|
+
* Remove ActiveRecord::Base.reset since Dispatcher doesn't use it anymore. [Rick Olson]
|
181
|
+
|
182
|
+
* PostgreSQL: autodetected sequences work correctly with multiple schemas. Rely on the schema search_path instead of explicitly qualifying the sequence name with its schema. #5280 [guy.naor@famundo.com]
|
183
|
+
|
184
|
+
* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
|
185
|
+
|
186
|
+
* Cache nil results for has_one associations so multiple calls don't call the database. Closes #5757. [Michael A. Schoen]
|
187
|
+
|
188
|
+
* Don't save has_one associations unnecessarily. #5735 [Jonathan Viney]
|
189
|
+
|
190
|
+
* Refactor ActiveRecord::Base.reset_subclasses to #reset, and add global observer resetting. [Rick Olson]
|
191
|
+
|
192
|
+
* Formally deprecate the deprecated finders. [Koz]
|
193
|
+
|
194
|
+
* Formally deprecate rich associations. [Koz]
|
195
|
+
|
196
|
+
* Fixed that default timezones for new / initialize should uphold utc setting #5709 [daniluk@yahoo.com]
|
197
|
+
|
198
|
+
* Fix announcement of very long migration names. #5722 [blake@near-time.com]
|
199
|
+
|
200
|
+
* The exists? class method should treat a string argument as an id rather than as conditions. #5698 [jeremy@planetargon.com]
|
201
|
+
|
202
|
+
* Fixed to_xml with :include misbehaviors when invoked on array of model instances #5690 [alexkwolfe@gmail.com]
|
203
|
+
|
204
|
+
* Added support for conditions on Base.exists? #5689 [josh@joshpeek.com]. Examples:
|
205
|
+
|
206
|
+
assert (Topic.exists?(:author_name => "David"))
|
207
|
+
assert (Topic.exists?(:author_name => "Mary", :approved => true))
|
208
|
+
assert (Topic.exists?(["parent_id = ?", 1]))
|
209
|
+
|
210
|
+
* Schema dumper quotes date :default values. [Dave Thomas]
|
211
|
+
|
212
|
+
* Calculate sum with SQL, not Enumerable on HasManyThrough Associations. [Dan Peterson]
|
213
|
+
|
214
|
+
* Factor the attribute#{suffix} methods out of method_missing for easier extension. [Jeremy Kemper]
|
215
|
+
|
216
|
+
* Patch sql injection vulnerability when using integer or float columns. [Jamis Buck]
|
217
|
+
|
218
|
+
* Allow #count through a has_many association to accept :include. [Dan Peterson]
|
219
|
+
|
220
|
+
* create_table rdoc: suggest :id => false for habtm join tables. [Zed Shaw]
|
221
|
+
|
222
|
+
* PostgreSQL: return array fields as strings. #4664 [Robby Russell]
|
223
|
+
|
224
|
+
* SQLServer: added tests to ensure all database statements are closed, refactored identity_insert management code to use blocks, removed update/delete rowcount code out of execute and into update/delete, changed insert to go through execute method, removed unused quoting methods, disabled pessimistic locking tests as feature is currently unsupported, fixed RakeFile to load sqlserver specific tests whether running in ado or odbc mode, fixed support for recently added decimal types, added support for limits on integer types. #5670 [Tom Ward]
|
225
|
+
|
226
|
+
* SQLServer: fix db:schema:dump case-sensitivity. #4684 [Will Rogers]
|
227
|
+
|
228
|
+
* Oracle: BigDecimal support. #5667 [schoenm@earthlink.net]
|
229
|
+
|
230
|
+
* Numeric and decimal columns map to BigDecimal instead of Float. Those with scale 0 map to Integer. #5454 [robbat2@gentoo.org, work@ashleymoran.me.uk]
|
231
|
+
|
232
|
+
* Firebird migrations support. #5337 [Ken Kunz <kennethkunz@gmail.com>]
|
233
|
+
|
234
|
+
* PostgreSQL: create/drop as postgres user. #4790 [mail@matthewpainter.co.uk, mlaster@metavillage.com]
|
235
|
+
|
236
|
+
* PostgreSQL: correctly quote the ' in pk_and_sequence_for. #5462 [tietew@tietew.net]
|
237
|
+
|
238
|
+
* PostgreSQL: correctly quote microseconds in timestamps. #5641 [rick@rickbradley.com]
|
239
|
+
|
240
|
+
* Clearer has_one/belongs_to model names (account has_one :user). #5632 [matt@mattmargolis.net]
|
241
|
+
|
242
|
+
* Oracle: use nonblocking queries if allow_concurrency is set, fix pessimistic locking, don't guess date vs. time by default (set OracleAdapter.emulate_dates = true for the old behavior), adapter cleanup. #5635 [schoenm@earthlink.net]
|
243
|
+
|
244
|
+
* Fixed a few Oracle issues: Allows Oracle's odd date handling to still work consistently within #to_xml, Passes test that hardcode insert statement by dropping the :id column, Updated RUNNING_UNIT_TESTS with Oracle instructions, Corrects method signature for #exec #5294 [schoenm@earthlink.net]
|
245
|
+
|
246
|
+
* Added :group to available options for finds done on associations #5516 [mike@michaeldewey.org]
|
247
|
+
|
248
|
+
* Observers also watch subclasses created after they are declared. #5535 [daniels@pronto.com.au]
|
249
|
+
|
250
|
+
* Removed deprecated timestamps_gmt class methods. [Jeremy Kemper]
|
251
|
+
|
252
|
+
* rake build_mysql_database grants permissions to rails@localhost. #5501 [brianegge@yahoo.com]
|
253
|
+
|
254
|
+
* PostgreSQL: support microsecond time resolution. #5492 [alex@msgpad.com]
|
255
|
+
|
256
|
+
* Add AssociationCollection#sum since the method_missing invokation has been shadowed by Enumerable#sum.
|
257
|
+
|
258
|
+
* Added find_or_initialize_by_X which works like find_or_create_by_X but doesn't save the newly instantiated record. [Sam Stephenson]
|
259
|
+
|
260
|
+
* Row locking. Provide a locking clause with the :lock finder option or true for the default "FOR UPDATE". Use the #lock! method to obtain a row lock on a single record (reloads the record with :lock => true). [Shugo Maeda]
|
261
|
+
# Obtain an exclusive lock on person 1 so we can safely increment visits.
|
262
|
+
Person.transaction do
|
263
|
+
# select * from people where id=1 for update
|
264
|
+
person = Person.find(1, :lock => true)
|
265
|
+
person.visits += 1
|
266
|
+
person.save!
|
267
|
+
end
|
268
|
+
|
269
|
+
* PostgreSQL: introduce allow_concurrency option which determines whether to use blocking or asynchronous #execute. Adapters with blocking #execute will deadlock Ruby threads. The default value is ActiveRecord::Base.allow_concurrency. [Jeremy Kemper]
|
270
|
+
|
271
|
+
* Use a per-thread (rather than global) transaction mutex so you may execute concurrent transactions on separate connections. [Jeremy Kemper]
|
272
|
+
|
273
|
+
* Change AR::Base#to_param to return a String instead of a Fixnum. Closes #5320. [Nicholas Seckar]
|
274
|
+
|
275
|
+
* Use explicit delegation instead of method aliasing for AR::Base.to_param -> AR::Base.id. #5299 (skaes@web.de)
|
276
|
+
|
277
|
+
* Refactored ActiveRecord::Base.to_xml to become a delegate for XmlSerializer, which restores sanity to the mega method. This refactoring also reinstates the opinions that type="string" is redundant and ugly and nil-differentiation is not a concern of serialization [DHH]
|
278
|
+
|
279
|
+
* Added simple hash conditions to find that'll just convert hash to an AND-based condition string #5143 [hcatlin@gmail.com]. Example:
|
280
|
+
|
281
|
+
Person.find(:all, :conditions => { :last_name => "Catlin", :status => 1 }, :limit => 2)
|
282
|
+
|
283
|
+
...is the same as:
|
284
|
+
|
285
|
+
Person.find(:all, :conditions => [ "last_name = ? and status = ?", "Catlin", 1 ], :limit => 2)
|
286
|
+
|
287
|
+
This makes it easier to pass in the options from a form or otherwise outside.
|
288
|
+
|
289
|
+
|
290
|
+
* Fixed issues with BLOB limits, charsets, and booleans for Firebird #5194, #5191, #5189 [kennethkunz@gmail.com]
|
291
|
+
|
292
|
+
* Fixed usage of :limit and with_scope when the association in scope is a 1:m #5208 [alex@purefiction.net]
|
293
|
+
|
294
|
+
* Fixed migration trouble with SQLite when NOT NULL is used in the new definition #5215 [greg@lapcominc.com]
|
295
|
+
|
296
|
+
* Fixed problems with eager loading and counting on SQL Server #5212 [kajism@yahoo.com]
|
297
|
+
|
298
|
+
* Fixed that count distinct should use the selected column even when using :include #5251 [anna@wota.jp]
|
299
|
+
|
300
|
+
* Fixed that :includes merged from with_scope won't cause the same association to be loaded more than once if repetition occurs in the clauses #5253 [alex@purefiction.net]
|
301
|
+
|
302
|
+
* Allow models to override to_xml. #4989 [Blair Zajac <blair@orcaware.com>]
|
303
|
+
|
304
|
+
* PostgreSQL: don't ignore port when host is nil since it's often used to label the domain socket. #5247 [shimbo@is.naist.jp]
|
305
|
+
|
306
|
+
* Records and arrays of records are bound as quoted ids. [Jeremy Kemper]
|
307
|
+
Foo.find(:all, :conditions => ['bar_id IN (?)', bars])
|
308
|
+
Foo.find(:first, :conditions => ['bar_id = ?', bar])
|
309
|
+
|
310
|
+
* Fixed that Base.find :all, :conditions => [ "id IN (?)", collection ] would fail if collection was empty [DHH]
|
311
|
+
|
312
|
+
* Add a list of regexes assert_queries skips in the ActiveRecord test suite. [Rick]
|
313
|
+
|
314
|
+
* Fix the has_and_belongs_to_many #create doesn't populate the join for new records. Closes #3692 [josh@hasmanythrough.com]
|
315
|
+
|
316
|
+
* Provide Association Extensions access to the instance that the association is being accessed from.
|
317
|
+
Closes #4433 [josh@hasmanythrough.com]
|
318
|
+
|
319
|
+
* Update OpenBase adaterp's maintainer's email address. Closes #5176. [Derrick Spell]
|
320
|
+
|
321
|
+
* Add a quick note about :select and eagerly included associations. [Rick]
|
322
|
+
|
323
|
+
* Add docs for the :as option in has_one associations. Closes #5144 [cdcarter@gmail.com]
|
324
|
+
|
325
|
+
* Fixed that has_many collections shouldn't load the entire association to do build or create [DHH]
|
326
|
+
|
327
|
+
* Added :allow_nil option for aggregations #5091 [ian.w.white@gmail.com]
|
328
|
+
|
329
|
+
* Fix Oracle boolean support and tests. Closes #5139. [schoenm@earthlink.net]
|
330
|
+
|
331
|
+
* create! no longer blows up when no attributes are passed and a :create scope is in effect (e.g. foo.bars.create! failed whereas foo.bars.create!({}) didn't.) [Jeremy Kemper]
|
332
|
+
|
333
|
+
* Call Inflector#demodulize on the class name when eagerly including an STI model. Closes #5077 [info@loobmedia.com]
|
334
|
+
|
335
|
+
* Preserve MySQL boolean column defaults when changing a column in a migration. Closes #5015. [pdcawley@bofh.org.uk]
|
336
|
+
|
337
|
+
* PostgreSQL: migrations support :limit with :integer columns by mapping limit < 4 to smallint, > 4 to bigint, and anything else to integer. #2900 [keegan@thebasement.org]
|
338
|
+
|
339
|
+
* Dates and times interpret empty strings as nil rather than 2000-01-01. #4830 [kajism@yahoo.com]
|
340
|
+
|
341
|
+
* Allow :uniq => true with has_many :through associations. [Jeremy Kemper]
|
342
|
+
|
343
|
+
* Ensure that StringIO is always available for the Schema dumper. [Marcel Molina Jr.]
|
344
|
+
|
345
|
+
* Allow AR::Base#to_xml to include methods too. Closes #4921. [johan@textdrive.com]
|
346
|
+
|
347
|
+
* Remove duplicate fixture entry in comments.yml. Closes #4923. [Blair Zajac <blair@orcaware.com>]
|
348
|
+
|
349
|
+
* When grouping, use the appropriate option key. [Marcel Molina Jr.]
|
350
|
+
|
351
|
+
* Add support for FrontBase (http://www.frontbase.com/) with a new adapter thanks to the hard work of one Mike Laster. Closes #4093. [mlaster@metavillage.com]
|
352
|
+
|
353
|
+
* Add warning about the proper way to validate the presence of a foreign key. Closes #4147. [Francois Beausoleil <francois.beausoleil@gmail.com>]
|
354
|
+
|
355
|
+
* Fix syntax error in documentation. Closes #4679. [mislav@nippur.irb.hr]
|
356
|
+
|
357
|
+
* Add Oracle support for CLOB inserts. Closes #4748. [schoenm@earthlink.net sandra.metz@duke.edu]
|
358
|
+
|
359
|
+
* Various fixes for sqlserver_adapter (odbc statement finishing, ado schema dumper, drop index). Closes #4831. [kajism@yahoo.com]
|
360
|
+
|
361
|
+
* Add support for :order option to with_scope. Closes #3887. [eric.daspet@survol.net]
|
362
|
+
|
363
|
+
* Prettify output of schema_dumper by making things line up. Closes #4241 [Caio Chassot <caio@v2studio.com>]
|
364
|
+
|
365
|
+
* Make build_postgresql_databases task make databases owned by the postgres user. Closes #4790. [mlaster@metavillage.com]
|
366
|
+
|
367
|
+
* Sybase Adapter type conversion cleanup. Closes #4736. [dev@metacasa.net]
|
368
|
+
|
369
|
+
* Fix bug where calculations with long alias names return null. [Rick]
|
370
|
+
|
371
|
+
* Raise error when trying to add to a has_many :through association. Use the Join Model instead. [Rick]
|
372
|
+
|
373
|
+
@post.tags << @tag # BAD
|
374
|
+
@post.taggings.create(:tag => @tag) # GOOD
|
375
|
+
|
376
|
+
* Allow all calculations to take the :include option, not just COUNT (closes #4840) [Rick]
|
377
|
+
|
378
|
+
* Add ActiveRecord::Errors#to_xml [Jamis Buck]
|
379
|
+
|
380
|
+
* Properly quote index names in migrations (closes #4764) [John Long]
|
381
|
+
|
382
|
+
* Fix the HasManyAssociation#count method so it uses the new ActiveRecord::Base#count syntax, while maintaining backwards compatibility. [Rick]
|
383
|
+
|
384
|
+
* Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions [Rick]
|
385
|
+
|
386
|
+
* Associations#select_limited_ids_list adds the ORDER BY columns to the SELECT DISTINCT List for postgresql. [Rick]
|
387
|
+
|
388
|
+
* Add :case_sensitive option to validates_uniqueness_of (closes #3090) [Rick]
|
389
|
+
|
390
|
+
class Account < ActiveRecord::Base
|
391
|
+
validates_uniqueness_of :email, :case_sensitive => false
|
392
|
+
end
|
393
|
+
|
394
|
+
* Allow multiple association extensions with :extend option (closes #4666) [Josh Susser]
|
395
|
+
|
396
|
+
class Account < ActiveRecord::Base
|
397
|
+
has_many :people, :extend => [FindOrCreateByNameExtension, FindRecentExtension]
|
398
|
+
end
|
399
|
+
|
400
|
+
|
1
401
|
*1.14.4* (August 8th, 2006)
|
2
402
|
|
3
403
|
* Add warning about the proper way to validate the presence of a foreign key. #4147 [Francois Beausoleil <francois.beausoleil@gmail.com>]
|
@@ -500,7 +900,6 @@
|
|
500
900
|
|
501
901
|
* Fixed :through relations when using STI inherited classes would use the inherited class's name as foreign key on the join model [Tobias Luetke]
|
502
902
|
|
503
|
-
|
504
903
|
*1.13.2* (December 13th, 2005)
|
505
904
|
|
506
905
|
* Become part of Rails 1.0
|
data/README
CHANGED
@@ -117,7 +117,7 @@ A short rundown of the major features:
|
|
117
117
|
|
118
118
|
|
119
119
|
* Transaction support on both a database and object level. The latter is implemented
|
120
|
-
by using Transaction::Simple[http://
|
120
|
+
by using Transaction::Simple[http://railsmanual.com/module/Transaction::Simple]
|
121
121
|
|
122
122
|
# Just database transaction
|
123
123
|
Account.transaction do
|
@@ -264,7 +264,7 @@ Lots of different finders
|
|
264
264
|
next_angle = Firm.find(1)
|
265
265
|
|
266
266
|
# SQL: SELECT * FROM companies WHERE id = 1 AND name = 'Next Angle'
|
267
|
-
next_angle = Company.
|
267
|
+
next_angle = Company.find(:first, :conditions => "name = 'Next Angle'")
|
268
268
|
|
269
269
|
next_angle = Firm.find_by_sql("SELECT * FROM companies WHERE id = 1").first
|
270
270
|
|
data/RUNNING_UNIT_TESTS
CHANGED
@@ -7,15 +7,16 @@ test/connections/<your database>/connection.rb.
|
|
7
7
|
When you have the database online, you can import the fixture tables with
|
8
8
|
the test/fixtures/db_definitions/*.sql files.
|
9
9
|
|
10
|
-
Make sure that you create database objects with the same user that you specified in
|
10
|
+
Make sure that you create database objects with the same user that you specified in
|
11
11
|
connection.rb otherwise (on Postgres, at least) tests for default values will fail.
|
12
12
|
|
13
13
|
== Running with Rake
|
14
14
|
|
15
15
|
The easiest way to run the unit tests is through Rake. The default task runs
|
16
16
|
the entire test suite for all the adapters. You can also run the suite on just
|
17
|
-
one adapter by using the tasks
|
18
|
-
|
17
|
+
one adapter by using the tasks test_mysql, test_sqlite, test_postgresql or any
|
18
|
+
of the other test_ tasks. For more information, checkout the full array of rake
|
19
|
+
tasks with "rake -T"
|
19
20
|
|
20
21
|
Rake can be found at http://rake.rubyforge.org
|
21
22
|
|
@@ -44,3 +45,20 @@ This gives a very large speed boost. With rake:
|
|
44
45
|
Or, by hand:
|
45
46
|
|
46
47
|
AR_TX_FIXTURES=yes ruby -I connections/native_sqlite3 base_test.rb
|
48
|
+
|
49
|
+
== Testing with Oracle
|
50
|
+
|
51
|
+
In order to allow for testing against Oracle using an "arunit" schema within an existing
|
52
|
+
Oracle database, the database name and tns connection string must be set in environment
|
53
|
+
variables prior to running the unit tests.
|
54
|
+
|
55
|
+
$ export ARUNIT_DB_NAME=MYDB
|
56
|
+
$ export ARUNIT_DB=MYDB
|
57
|
+
|
58
|
+
The ARUNIT_DB_NAME variable should be set to the name by which the database knows
|
59
|
+
itself, ie., what will be returned by the query:
|
60
|
+
|
61
|
+
select sys_context('userenv','db_name') db from dual
|
62
|
+
|
63
|
+
And the ARUNIT_DB variable should be set to the tns connection string.
|
64
|
+
|