Commit Graph

786 Commits

Author SHA1 Message Date
Jeremy Kemper
8dea60b0c3 find supports :lock with :include. Check whether your database allows SELECT ... FOR UPDATE with outer joins before using. Closes #6764.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5682 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-05 22:07:55 +00:00
Tobias Lütke
0ee0c1b2aa Add AssociationCollection#create! to be consistent with AssociationCollection#create when dealing with a foreign key that is a protected attribute
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5677 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-05 17:55:44 +00:00
David Heinemeier Hansson
22f095be23 Added counter optimization for AssociationCollection#any? so person.friends.any? won't actually load the full association if we have the count in a cheaper form [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5676 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-05 03:26:56 +00:00
Jeremy Kemper
8ffb22056c Subclasses of an abstract class work with single-table inheritance. Closes #5704.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-01 21:24:47 +00:00
Michael Koziarski
a2e826dc0f Change fixture_path to a class inheritable accessor allowing test cases to have their own custom set of fixtures. Closes #6672 [zdennis]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5604 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-21 22:28:24 +00:00
Jeremy Kemper
9104d63f99 Quote ActiveSupport::Multibyte::Chars. Closes #6653.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5597 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 12:02:04 +00:00
Jeremy Kemper
cd6beacfb3 Test for forged '' default before it's typecast. Closes #6156.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5596 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 11:44:31 +00:00
Jeremy Kemper
6e1012fc9c Test has_one :dependent => :nullify with missing association. Closes #4848.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5595 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 11:29:21 +00:00
Jeremy Kemper
ced5d89425 Test has_one :dependent => :nullify with missing association. Closes #4828.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5594 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 11:28:35 +00:00
Jeremy Kemper
427fb035a3 Simplify query_attribute by typecasting the attribute value and checking whether it's nil, false, zero or blank. Closes #6659.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5593 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 11:22:38 +00:00
Jeremy Kemper
9594832a8d validates_numericality_of uses \A \Z to ensure the entire string matches rather than ^ $ which may match one valid line of a multiline string. Closes #5716.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5589 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 10:51:50 +00:00
Jeremy Kemper
88bd86e8bc Run validations in the order they were declared. Closes #6657.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5588 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 10:12:38 +00:00
Jeremy Kemper
19c99acfbc 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. Closes #6156.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5586 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-20 08:54:42 +00:00
Jeremy Kemper
02adc49d72 Simplify association proxy implementation by factoring construct_scope out of method_missing. Closes #6643.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5564 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-19 11:16:12 +00:00
Jeremy Kemper
be3a4c3daa Mysql::Result#all_hashes compatibility with Mysql C driver 2.6.x. Closes #6601.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5533 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-16 01:41:22 +00:00
Jeremy Kemper
50ee332c4a Cleanup SQLite AUTOINCREMENT: exclude sqlite_sequence table, factor out feature availability check.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5520 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-14 03:32:16 +00:00
Jeremy Kemper
fda4330ce9 Update Oracle performance credits.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5518 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-14 02:49:33 +00:00
Jeremy Kemper
4978d1dce7 Oracle: automatically detect the primary key. Closes #6594.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5514 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-13 19:23:32 +00:00
Jeremy Kemper
a303a168ac Oracle: to increase performance, prefetch 100 rows and enable similar cursor sharing. Both are configurable in database.yml. Closes #6607.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-13 07:36:52 +00:00
Jeremy Kemper
c0bce43e90 Oracle: fix limited id selection for eager loading. Closes #6515.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5480 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-10 19:18:07 +00:00
Jeremy Kemper
63df6eb382 Don't inspect unloaded associations. Closes #2905.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5478 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-10 02:00:14 +00:00
Jeremy Kemper
d97a84fb59 SQLite: use AUTOINCREMENT primary key in >= 3.1.0. Closes #6588.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5477 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-09 21:17:43 +00:00
Jeremy Kemper
9d2da04680 Cache inheritance_column. Closes #6592.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-09 19:31:31 +00:00
Jeremy Kemper
66b92abfc3 Firebird: decimal/numeric support. Closes #6408.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5459 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-07 19:56:01 +00:00
Jamis Buck
57a3e44052 make add_order a tad faster (Closes #6567)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5452 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-07 19:06:35 +00:00
Jeremy Kemper
a3dba1ed7c Find with :include respects scoped :order. Closes #5850.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5445 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-07 00:18:07 +00:00
Jeremy Kemper
2fbe0ae7a2 Support nil and Array in :conditions => { attr => value } hashes. Closes #6548.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5435 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-05 21:27:51 +00:00
Jeremy Kemper
5b979ed8ff Consistently use LOWER() for uniqueness validations (rather than mixing with UPPER()) so the database can always use a functional index on the lowercased column. Closes #6495.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5434 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-05 19:20:39 +00:00
Jeremy Kemper
b6171e7105 SQLite: count(distinct) queries supported in >= 3.2.6, fix calculations workaround, remove count(distinct) query rewrite, cleanup test connection scripts. Closes #6544.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5426 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-05 02:01:31 +00:00
Jeremy Kemper
c7c3994d31 Dynamically generate reader methods for serialized attributes. Closes #6362.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5416 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-02 20:20:46 +00:00
Jeremy Kemper
88d9b32496 Deprecation: object transactions warning.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5405 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-02 18:12:18 +00:00
Jeremy Kemper
ac715b2bcb has_one :dependent => :nullify ignores nil associates. Closes #6528.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5401 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-02 09:45:17 +00:00
Jeremy Kemper
70840d4b7f Oracle: resolve test failures, use prefetched primary key for inserts, check for null defaults. Factor out some common methods from all adapters. Closes #6515.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5384 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-11-01 20:28:48 +00:00
Michael Koziarski
53a97e9d61 Make add_column use the options hash with the Sqlite Adapter. Closes #6464 [obrie]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5353 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-24 07:32:18 +00:00
Marcel Molina
fb7807e244 Document other options available to migration's add_column. #6419
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5333 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-22 02:55:21 +00:00
Jeremy Kemper
8949ce0982 MySQL: all_hashes compatibility with old MysqlRes class. Closes #6429.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5330 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-20 20:30:59 +00:00
Rick Olson
c5536f9f00 Fix has_many :through to add the appropriate conditions when going through an association using STI. Closes #5783. [Jonathan Viney] (sorry, forgot to commit the actual files)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5310 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-16 15:42:55 +00:00
Rick Olson
e789b26e65 fix select_limited_ids_list issues in postgresql, retain current behavior in other adapters [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5291 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-13 08:29:00 +00:00
Rick Olson
7870494673 Restore eager condition interpolation, document it's differences [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5284 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-11 14:02:24 +00:00
Jeremy Kemper
629b8af2b0 Wrap save! in a transaction. Closes #6324.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5281 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-10 19:34:25 +00:00
Jeremy Kemper
2c3ca4c4e6 Don't rollback in teardown unless a transaction was started. Don't start a transaction in create_fixtures if a transaction is started. Closes #6282.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5270 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 07:48:27 +00:00
Rick Olson
850087f0bd Add #delete support to has_many :through associations. Closes #6049 [Martin Landers]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5267 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 03:21:52 +00:00
Rick Olson
c98b471ca4 Reverted old select_limited_ids_list postgresql fix that caused issues in mysql. Closes #5851 [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5265 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 03:12:32 +00:00
Rick Olson
8e3bf70bcd 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]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5264 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 02:46:57 +00:00
David Heinemeier Hansson
943be923f0 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 (closes #6126) [wreese@gmail.com] Added default timeout setting of 5 seconds to SQLite3 database.yml configurations [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5258 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 02:02:27 +00:00
David Heinemeier Hansson
55aab5b8ac Added update_attributes! which uses save! to raise an exception if a validation error prevents saving (closes #6192) [jonathan]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5256 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 01:52:24 +00:00
David Heinemeier Hansson
9fd88d7939 Deprecated add_on_boundary_breaking (use validates_length_of instead) (closes #6292) [BobSilva]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5255 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-09 01:42:09 +00:00
Jeremy Kemper
0c3c131f3b The has_many create method works with polymorphic associations. Closes #6361.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-08 06:45:32 +00:00
Jeremy Kemper
48d4d43f92 MySQL: introduce Mysql::Result#all_hashes to support further optimization. Closes #5581.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5219 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-02 20:43:13 +00:00
Jeremy Kemper
ef4fb3dee2 save! shouldn't validate twice. Closes #6324.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-02 03:21:32 +00:00