Commit Graph

479 Commits

Author SHA1 Message Date
Curtis Hawthorne
0d922885fb Ensure Model#destroy respects optimistic locking [#1966 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-09 14:56:09 +00:00
Jim Remsik and Tim Pope
1e6c50e21b Ensure has_many :through works with changed primary keys [#736 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-09 13:43:28 +00:00
Rob Anderton
faf4ba6b79 Allow find(:last) :order be a symbol [#2024 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-09 12:52:14 +00:00
Jan De Poorter
277c799d58 Fix find_by_last when order is given [#2127 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2009-03-09 13:02:31 +01:00
Jeremy Kemper
1c36172c13 Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Jeffrey Hardy
96eaeee446 Add ActiveRecord::Base#invalid? as the opposite of #valid? [#2159 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-08 15:20:23 +00:00
Pratik Naik
df8669d4b5 Fix calculation tests to work on sqlite 2009-03-07 16:36:40 +00:00
stopdropandrew
6543426c73 Ensure calculations respect scoped :select [#1334 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-07 15:26:56 +00:00
Arthur Klepchukov
ccb0a92fa2 Ensure validates_uniqueness_of considers limit on the field. [#1042 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-07 13:52:17 +00:00
Adam Milligan
f36513653f Fix RDoc grammar and ensure hm:t tests can run in isolation. [#1644 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-07 12:34:56 +00:00
Pratik Naik
fd3ccbe955 DRY with_kcode in Active Record tests 2009-03-07 11:06:44 +00:00
Marcello Nuccio
dfcf1e4cf6 Fixed broken migrations tests: added assert_equal. [#1704 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-07 11:00:24 +00:00
Will Bryant
7fb7b48a1f Allow :having conditions to be sanitized like regular :condition. [#2158 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-06 22:29:53 +00:00
Adam Cooper
3ca5a0f9fd Ensure belongs_to association with a counter cache in name spaced model works [#1678 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-06 22:05:18 +00:00
Dimitri Krassovski
984bc7a614 Ensure replacing has_one associations respects the supplied :dependent option. [#1305 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-06 19:11:13 +00:00
Pratik Naik
4863634a15 Ensure supplie :from has precedence over scoped :from [#1370 state:resolved] 2009-03-06 18:36:30 +00:00
Tom Lea
c896d56c6e Ensure self referential HABTM associations raise an exception if association_foreign_key is missing. [#1252 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-06 18:27:34 +00:00
jvoorhis
6a13376525 Methods invoked within named scope Procs should respect the scope stack. [#1267 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-06 16:47:50 +00:00
Mike Gunderloy
c653f700d3 Fix that scoped find with :group and :having [#2006 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-02-28 17:35:58 +00:00
Eloy Duran
e2b925fa68 Don't validate records of an :autosave association if they're marked for destruction. [#2064 status:resolved]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2009-02-27 13:57:27 +01:00
David Heinemeier Hansson
5cda000bf0 Fixed that autosave should validate associations even if master is invalid [#1930 status:committed] 2009-02-27 13:50:24 +01:00
Manfred Stienstra
809409d92f Add test case for ActiveRecord::ConnectionAdapters::ConnectionManagement.
- Make sure ConnectionManagement clears connections after each call, except in tests

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-02-25 12:48:53 -06:00
rick
1cfc39e7e7 update the default scope test to take the model's default scope into account 2009-02-25 09:27:44 -08:00
Diego Algorta
0dd2f96f5c Fixed bug that makes named_scopes _forgot_ current scope 2009-02-25 09:21:08 -08:00
David Heinemeier Hansson
d13623ca46 Added ActiveRecord::Base.each and ActiveRecord::Base.find_in_batches for batch processing [DHH/Jamis Buck] 2009-02-23 12:11:02 +01:00
Michael Koziarski
06040849b5 Revert "Wrap calls to update_attributes in a transaction."
This caused failures on sqlite, sqlite3 and postgresql

This reverts commit fc09ebc669bd58f415f7d3ef932ef02dab821ab5.
[#922 state:reopened]
2009-02-22 16:41:04 +13:00
Xavier Noria
fc09ebc669 Wrap calls to update_attributes in a transaction.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#922 state:committed]
2009-02-22 15:31:27 +13:00
Lance Ivy
5dbc9d40a4 Changed API of NestedAttributes to take an array, or hash with index keys, of hashes that have the id on the inside of the attributes hash and updated the FormBuilder to produce such hashes. Also fixed NestedAttributes with composite ids.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
[#1892 state:committed]
2009-02-13 21:47:56 +13:00
Will Bryant
9991868d85 support end-exclusive ... Ranges in SQL hash condition sanitization properly
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1865 state:committed]
2009-02-06 13:43:02 +13:00
Max Lapshin
1fe9d6cc88 Support true/false in query_attribute for calculated columns
Signed-off-by: Tarmo Tänav <tarmo@itech.ee>
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-02-06 13:39:08 +13:00
Max Lapshin
9c6bde58c5 Fixed tests of postgresql money insertion when non-C locale
Signed-off-by: Tarmo Tänav <tarmo@itech.ee>
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-02-06 13:39:07 +13:00
Eloy Duran
db5d695016 Also save :autosave enabled associations when #save! is used.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1877 state:committed]
2009-02-06 13:38:15 +13:00
Pascal Ehlert
455a7633db Nested attribute accessors should ignore new records with truthy _delete key.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1861 state:committed]
2009-02-06 13:36:59 +13:00
Scott Taylor
5a8f764661 Add ActiveRecord::Base.exists? with no args [#1817 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2009-02-05 20:51:06 +01:00
Jeremy Kemper
278186534c Bump mocha requirement for Ruby 1.9 compat. Remove uses_mocha. 2009-02-03 18:40:22 -08:00
Michael Koziarski
fa7aa19a99 Don't rely on the order in these tests 2009-02-01 15:27:41 +13:00
miloops
2b8be761e4 validate_length_of should use custom message if given when using in or within.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1057 state:committed]
2009-02-01 14:58:17 +13:00
Eloy Duran
ec8f045844 Add support for nested object forms to ActiveRecord and the helpers in ActionPack
Signed-Off-By: Michael Koziarski <michael@koziarski.com>

[#1202 state:committed]
2009-02-01 14:44:30 +13:00
Jacob Dunphy
e6493eb9b7 Sqlite adapter's copy_table incorrectly attempts to recreate a primary key id (:id => true in the create_table) if an :id column is present, even if it isn't a primary_key.
This fix sets :id => false if there is an :id column, but it's not the primary_key.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1766 state:committed]
2009-01-29 17:34:33 +13:00
Filip H.F. "FiXato" Slagter
a0d8202bb9 Ensure whitespaces are stripped when merging string joins. [#1297 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-01-28 19:50:55 +00:00
Pratik Naik
74871961ec Add array id support to Model.update_counters. [#1254 state:resolved] [Carlos Júnior] 2009-01-28 19:20:55 +00:00
Dov Murik
5fe6635e05 Mysql#reconnect is set according to the 'reconnect' key in the connection spec.
The 'reconenct' boolean option is read from the connection specification
and is used to set the reconnect attribute of Mysql.  The default is
false in order not to change existing application behaviour.

Also, reconnect is set AFTER real_connect is called, so its value sticks
(the mysql gem sets reconnect to false inside real_connect).

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1797 state:committed]
2009-01-27 09:55:25 +13:00
Pratik Naik
fe6ffce51d Make sure inner scope conditions get a preference over the outer ones 2009-01-24 17:54:10 +00:00
Pratik Naik
3b1cd9e525 Fix has_and_belongs_to_many_associations tests. #1738 2009-01-18 00:34:57 +00:00
lukeludwig
3ee4e00918 Cache columns for has_and_belongs_to_many associations
This avoids repeatedly calling SHOW COLUMNS when the association is queried
[#1738 state:committed]
2009-01-17 18:09:13 +13:00
Carlos Kozuszko
5ed119c005 Fix dirty handling of nullable non-integer numeric columns [#1692 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2009-01-16 17:23:35 +00:00
Ben VandenBos
0e92f67073 Make belongs_to :dependent => :destroy destroy self before associated object [#1079 state:resolved]
If foreign key constraints are in place then deleteing the associated object first will cause a foreign key violation

Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2009-01-16 17:23:19 +00:00
Michael Koziarski
f2ee3f20df Fix the AR json serialization tests to comply with the earlier change to quote keys correctly 2009-01-16 17:57:45 +13:00
Michael Lovitt
7a0e7c7270 Fixed broken after_save callback; was being called when before_create was canceled or before_update was canceled
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1735 state:committed]
2009-01-16 10:11:58 +13:00
Carlos Kozuszko
c891d685de Fixing bug on ActiveRecord::Dirty#field_changed? for nullable numeric columns, NULL gets stored in database for blank (i.e. '') values. Only integer columns were considered.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1692 state:committed]
2009-01-16 10:00:39 +13:00