Commit Graph

1810 Commits

Author SHA1 Message Date
Eloy Duran
f82adc7c5a 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:19:48 +01:00
Eloy Duran
1afa9fa5a9 Refactored nested attributes a bit around :reject_if => :all_blank. 2010-01-07 13:19:48 +01:00
José Valim
0c2d933f36 Ensure before_validation and after_validation accepts :on as option. 2010-01-06 22:24:16 +01:00
Joshua Peek
e5ed62deea Autoload AR test case 2010-01-04 16:50:01 -06:00
David Heinemeier Hansson
5e94d3e3ea Merge 2010-01-03 22:27:28 -08:00
David Heinemeier Hansson
1459c8cc1d Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default [DHH] 2010-01-03 19:30:28 -08:00
Pratik Naik
a68165833a Add Relation#create_with to explictily specify create scope 2010-01-04 03:50:16 +05:30
Pratik Naik
a115b5d79a Ensure using proper engine for Arel::Table 2010-01-04 02:05:18 +05:30
Pratik Naik
00f3f6dc31 Relation#merge and Relation#except should respect locks 2010-01-03 21:25:19 +05:30
Pratik Naik
af5e1b4cc6 Add Relation#except 2010-01-03 19:43:29 +05:30
Pratik Naik
3eca0ab838 Give preference to the second relation's order when merging 2010-01-03 18:52:30 +05:30
Pratik Naik
6f5f23aaa7 Add Relation#includes to be an equivalent of current finder option :include 2010-01-03 03:24:28 +05:30
José Valim
5fdd0e80a4 Be sure to convert namespaced names to we have 'Parrots name' instead of 'Parrots.name' in error messages. 2010-01-02 22:27:02 +01:00
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