José Valim
dcafe995bf
Make nested attributes behave like in 2.3.5 and add a sanity test for it with I18n.
2010-01-02 22:27:02 +01:00
Pratik Naik
ac1df91e5e
Implement Relation#create and Relation#create!
2010-01-03 00:16:14 +05:30
Pratik Naik
65200d2933
Implement Relation#new
2010-01-03 00:08:59 +05:30
Pratik Naik
3e6e3e90ef
Remove the test which was testing a non-existing method, always failing on 1.9 and never even running on 1.8
2010-01-02 16:12:01 +05:30
José Valim
8c5fe60ec8
Simplify repair_validations on AR and make it work with new callbacks.
2010-01-01 03:20:38 +01:00
Pratik Naik
8734f9a271
Relation#many? shoud load the records if there's a LIMIT
2009-12-30 12:14:00 +05:30
Pratik Naik
bdf59a5618
Add Relation#any? and Relation#many?
2009-12-30 12:11:22 +05:30
Pratik Naik
a56518aee2
Fix the count test for postgres
2009-12-30 10:41:47 +05:30
Emilio Tagua
00cd3789f6
Relation#count should look for projections in chained relations and perform the count on the given column
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2009-12-30 01:12:38 +05:30
Pratik Naik
981f696398
Relation#respond_to? should take second argument for responding to private methods
2009-12-29 12:31:08 +05:30
Pratik Naik
bc933d0fa1
Make sure Relation responds to dynamic finder methods
2009-12-29 12:27:40 +05:30
Pratik Naik
f290e685f0
Add Relation#size and Relation#empty?
2009-12-29 12:15:28 +05:30
Pratik Naik
54b80c7361
Add Relation#delete_all
2009-12-29 11:46:07 +05:30
Pratik Naik
078ea0dfbd
Oops. Remove debug information inside a test from the previous commit
2009-12-29 04:33:37 +05:30
Pratik Naik
08633bae5e
Migrate all the calculation methods to Relation
2009-12-29 04:30:04 +05:30
Jeremy Kemper
949c8c0d0e
Don't publicize with_scope for tests since it may shadow public misuse
2009-12-28 14:07:23 -08:00
Jeremy Kemper
d927265abd
Fix pg test
2009-12-28 13:05:36 -08:00
Jeremy Kemper
9fe42232f1
Merge commit 'Fingertips/master'
2009-12-28 12:50:56 -08:00
Eloy Duran
c23fbd0d47
Refactored previous changes to nested attributes.
2009-12-28 21:09:22 +01:00
Michael Siebert
07b615fb89
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 21:09:19 +01:00
Jeremy Kemper
632df063a3
Merge commit 'josevalim/validations'
2009-12-28 11:13:35 -08:00
Eloy Duran
9c771a9608
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:56:31 +01:00
Murray Steele
ff508640e2
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 15:12:17 +01:00
Murray Steele
6a74ee7f4d
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 15:12:15 +01:00
George Ogata
81ca0cf2b0
Add inverse polymorphic association support. [ #3520 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-12-28 15:12:13 +01:00
Murray Steele
6c8c85bc1e
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 15:12:11 +01:00
George Ogata
fc85c66527
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 15:12:07 +01:00
Pratik Naik
8f5d9eb0e2
Add Relation#count
2009-12-28 18:38:28 +05:30
Pratik Naik
02207dc02c
Add Model.readonly and association_collection#readonly finder method
2009-12-28 16:17:46 +05:30
Pratik Naik
b95cc72429
Raise ArgumentError when trying to merge relations of different classes
2009-12-28 14:24:52 +05:30
Pratik Naik
92c982d973
Relation#readonly(false) should toggle the readonly flag
2009-12-28 14:20:54 +05:30
Pratik Naik
9f4e98330b
Remove unused construct_finder_sql
2009-12-28 12:57:35 +05:30
Pratik Naik
1c26ba486c
Add Model.from and association_collection#from finder methods
2009-12-28 03:59:44 +05:30
Pratik Naik
630dc50730
Fix relation tests for postgres
2009-12-28 02:50:04 +05:30
Pratik Naik
51a1d5a670
Handle preloads and eager loads when merging relations
2009-12-28 01:33:20 +05:30
Pratik Naik
a8b10a2a8d
Add relation#merge to merge two relations
2009-12-28 01:08:34 +05:30
Pratik Naik
bbdeaae2ca
Add relation.destroy_all
2009-12-27 21:15:12 +05:30
Pratik Naik
d5e98dc859
Add relation.last and relation.reverse_order
2009-12-27 19:04:30 +05:30
Pratik Naik
2c8f83556b
Add relation.exists?
2009-12-27 18:00:49 +05:30
Pratik Naik
d92c4a8402
Add find(ids) to relations
2009-12-27 16:15:29 +05:30
Pratik Naik
81608cf8fa
Make Model.all return an array rather than a relation for consistency. Use Model.scoped to get a relation
2009-12-27 15:06:45 +05:30
Pratik Naik
85770ec713
Make Model.find_or_create_by_* and find_or_initialize_by_* use relations and remove method caching
2009-12-27 14:46:38 +05:30
Pratik Naik
d511de0261
Add find_or_create_by_* and find_or_initialize_by_* to relations
2009-12-27 14:28:19 +05:30
Pratik Naik
8829d6ecc6
Make Model.find_by_* and Model.find_all_by_* use relations and remove dynamic method caching
2009-12-27 13:17:29 +05:30
Pratik Naik
f6f416c58e
Add find_by_* and find_all_by_* finders to ActiveRecord::Relation
2009-12-27 03:25:29 +05:30
Pratik Naik
cc753eaf58
Replace Model.first(options) with new finder methods inside tests
2009-12-27 01:50:03 +05:30
Pratik Naik
83f24afd44
Add new finder methods to association collection.
2009-12-27 00:25:00 +05:30
Pratik Naik
f374150698
Ensure Model.scoped adds type conditions for STI models
2009-12-27 00:11:31 +05:30
Pratik Naik
c6258ee313
Ensure all the finder methods respect scoping
2009-12-26 19:15:05 +05:30
Pratik Naik
9a9f97af28
Add relation.reload to force reloading the records
2009-12-26 15:31:50 +05:30