Xavier Noria
bb2327d9ab
method rename to fix a broken test
2010-05-18 00:31:41 +02:00
Rizwan Reza
32b0b5f7b2
Deprecate Array#rand in favor of Array#random_element [ #4555 stated:committed]
...
Signed-off-by: Xavier Noria <fxn@hashref.com >
2010-05-17 23:56:44 +02:00
Wijnand Wiersma
5b1f4c51ce
Postgresql doesn't allow to change a string type column to a binary type. Skip this test for postgresql for now.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-16 15:15:16 +02:00
Nobuhiro IMAI
e535b45c86
make fixture accessors private
...
prevent to be run fixture accessor (e.g. test_foos for TestFoo model) as a test case
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-16 10:35:23 +02:00
Elomar França
ddadcc7cf8
Don't carry default value when changing column for a binary type on MySQL [ #3234 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-16 10:30:47 +02:00
Lawrence Pit
0706bdce60
docs + test for each_error
...
[#3185 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-15 11:49:04 -07:00
Josh Kalderimis
8e7a64d090
backported AR correction to find_each and find_in_batches to raise when the user uses select but does not specify the primary key
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-15 09:51:58 +02:00
José Valim
6949d6f54f
Remove deprecated tests according to 8e679f1
2010-05-14 23:43:21 +02:00
Santiago Pastorino
ad73a3aec4
type_cast_calculated_value refactor: value is never a Fixnum here. Fix test since SQLite returns Float.
...
[#4514 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-11 22:28:36 -07:00
Pratik Naik
77adb4bc20
Revert "Revert "Add index length support for MySQL [ #1852 state:resolved]" (breaks the build)"
...
This reverts commit eababa35cf .
2010-05-09 12:34:07 +01:00
Carl Lerche
eababa35cf
Revert "Add index length support for MySQL [ #1852 state:resolved]" (breaks the build)
...
This reverts commit 3616141fa2 .
2010-05-08 23:56:06 +03:00
Emili Parreno
3616141fa2
Add index length support for MySQL [ #1852 state:resolved]
...
Example:
add_index(:accounts, :name, :name => 'by_name', :length => 10)
=> CREATE INDEX by_name ON accounts(name(10))
add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :length => {:name => 10, :surname => 15})
=> CREATE INDEX by_name_surname ON accounts(name(10), surname(15))
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2010-05-08 12:43:34 +01:00
Santiago Pastorino
f967b352d2
Make find_or_create and find_or_initialize work mixing explicit parameters and a hash. ht: Marc-André Lafortune
...
[#4457 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-07 13:29:51 -07:00
Pratik Naik
f194d65f36
Use primary key in conditions, not 'id' [ #4395 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
Conflicts:
activerecord/test/cases/nested_attributes_test.rb
2010-05-04 22:45:16 +01:00
Jatinder Singh
aeff1719ab
AR JSON Serializer now supports custom root option.
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-04 13:18:27 -07:00
Neeraj Singh
dcf0f97514
making rake:migrate VERSION=0 a noop called in succession. [ #2137 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-29 13:32:12 +02:00
Curtis Hawthorne
ce5af2fefe
Destroy respects optimistic locking.
...
Now works with :dependent => :destroy and includes unit tests for that
case. Also includes better error messages when updating/deleting stale
objects.
[#1966 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-27 21:52:22 -07:00
Jeremy Kemper
457a54653d
Remove quoted_string_prefix entirely since PostgreSQL was the only database adapter relying on it.
2010-04-24 16:27:34 -07:00
Mislav Marohnić
8be3e09fcf
fix reset_counters to work even with complex class names
...
e.g. it guesses that a belongs_to association to Namespace::MyModel is
named "my_model", unlike before where it would look up an association
named "namespace::mymodel" and fail.
2010-04-17 03:13:13 +02:00
Mislav Marohnić
ef0591efc2
cleanup update/reset_counters; refactor tests
2010-04-17 03:13:00 +02:00
Eugene Pimenov
18ba648e0d
Implement find_in_batches without with_scope [ #2227 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2010-04-15 01:13:16 +01:00
Pratik Naik
5efb1503dd
Ensure not to load the entire association when bulk updating existing records using nested attributes
2010-04-14 01:51:43 +01:00
Andrew White
e617af13a2
Backport of lazy evaluation of has_many ..., :dependent => :___
...
[#2627 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-04 07:01:38 -07:00
Pratik Naik
1f44fc90c6
Dont use Rails 3 finder syntax in Rails 2.3.x test [ #4303 state:resolved]
2010-03-31 14:14:56 +01:00
Pratik Naik
0e57c70baf
Dont try to load the record from the db if preloading didn't find anything
2010-03-31 12:57:06 +01:00
Joseph Wilk
ea6ef768a7
Fixed a bug where create_table could not be called without a block [ #2221 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2010-03-30 15:00:44 +13:00
Joey Aghion
715b34fdff
use supplied primary key when eager-loading belongs_to associations rather than default primary key
...
[#765 ]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-03-29 15:33:45 -07:00
Ernie Miller
00b95eb265
belongs_to associations now honor :primary_key option for joins
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-03-29 15:33:37 -07:00
Andrew White
03d5d0b5f5
Add the ability to specify table_name_prefix on individual modules
...
[#4032 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-03-29 08:55:21 -07:00
Tobias Bielohlawek
b06e5dce97
fixed a 'RecordNotFound' bug when calling 'reload' on a object which doesn't met the default_scope conditions, added test [ #3166 status:resolved]
...
The reload method didn't made use of 'with_exclusive_scope' when reloading the object. This lead to a RecordNotFound exception, in case the object doesn't met the default_scope condition (anymore) - which is obviously a bug. This quick fix makes use of with_exclusive_scope in the reload method as well. See test for full example.
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-02-26 11:39:15 +01:00
Eloy Duran
51e6124e6a
Renamed AssociationReflection #collection_association? to #collection?.
2010-01-08 21:44:06 +01:00
Eloy Duran
c9a3929a75
Rollback the transaction when one of the autosave associations fails to save. [ #3391 state:resolved]
2010-01-08 21:36:27 +01:00
Lawrence Pit
eb22c248de
Exclude unchanged records from the collection being considered for autosave. [ #2578 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2010-01-08 21:36:27 +01:00
Bryan Stearns
2aef092625
Add failing test that triggers the stack overflow for #2578 .
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2010-01-08 21:36:26 +01:00
Eloy Duran
0dbe0f670e
Raise a RecordNotFound if an ID in nested attributes is given but doesn't return a record. [ #2415 state:resolved]
2010-01-07 13:20:43 +01:00
Eloy Duran
6d056c7175
Moved the validation logic to the association reflection and refactored autosave_association.rb a bit.
2010-01-07 13:20:43 +01:00
Eloy Duran
b3bd101796
Remove deprecated '_delete' option from NestedAttributes.
2010-01-07 13:20:42 +01:00
Eloy Duran
f12dd62d47
Add AssociationReflection#collection_association? which returns true if it's for a has_many or has_and_belongs_to_many association.
2010-01-07 13:20:42 +01:00
Eloy Duran
e20ac99026
Refactored nested attributes a bit after last commit.
2010-01-07 13:20:42 +01:00
Mike Breen
69db137f89
Allows you to pass :all_blank to :reject_if option to automatically create a Proc that will reject any record with blank attributes.
...
[#2501 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2010-01-07 13:20:41 +01:00
Stefan Penner
b3dd14adbe
Failing test case RE: Ticket 3131
...
http://rails.lighthouseapp.com/projects/8994/tickets/3131-multiparamter_attribute-assignment-fails-when-used-via-assoication
2010-01-02 23:48:08 -08:00
Jeremy Kemper
54bc4852ea
Fix pg test
2009-12-28 13:05:44 -08:00
Eloy Duran
90f001ba39
Refactored previous changes to nested attributes.
2009-12-28 21:08:20 +01:00
Michael Siebert
7074c5a629
Add an :update_only option to accepts_nested_attributes_for for to-one associations. [ #2563 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-12-28 19:02:01 +01:00
Eloy Duran
146a750568
Make sure to not add autosave callbacks multiple times. [ #3575 state:resolved]
...
This makes sure that, in a HABTM association, only one join record is craeted.
2009-12-28 16:46:48 +01:00
Murray Steele
3470b306bb
Make polymorphic_inverse_of in Reflection throw an InverseOfAssociationNotFoundError if the supplied class doesn't have the appropriate association. [ #3520 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-12-28 14:21:42 +01:00
Murray Steele
603b28c84c
Provide a slightly more robust we_can_set_the_inverse_on_this? method for polymorphic belongs_to associations. [ #3520 state:resolved]
...
Also add a new test for polymorphic belongs_to that test direct accessor assignment, not just .replace assignment.
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-12-28 14:21:18 +01:00
George Ogata
cca75ca23f
Add inverse polymorphic association support. [ #3520 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-12-28 14:20:58 +01:00
Murray Steele
592085be83
Add more tests for the various ways we can assign objects to associations. [ #3513 state:resolved]
...
Get rid of a duplicate set_inverse_instance call if you use new_record(true) (e.g. you want to replace the existing instance).
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-12-28 14:20:33 +01:00
George Ogata
ed5b89483a
Set inverse for #replace on a has_one association. [ #3513 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-12-28 14:18:46 +01:00