Commit Graph

73 Commits

Author SHA1 Message Date
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
32b48bf419 Use arel predicates instead of strings wherever possible when merging relations 2010-01-02 22:43:40 +05:30
Pratik Naik
f1acf1cc74 Give higher preference to second relation's equality predicates when merging 2010-01-02 21:16:16 +05:30
Pratik Naik
498fddc714 Fix join string for the WHERE clause 2010-01-02 03:20:52 +05:30
Pratik Naik
93555c672e Add Relation#table to get the relevant Arel::Table 2010-01-01 00:56:49 +05:30
Pratik Naik
d5f9173926 Add Relation#delete [Pratik Naik, Emilio Tagua] 2010-01-01 00:17:40 +05:30
Pratik Naik
7aabaac0f5 Organize Relation methods into separate modules 2009-12-30 19:29:26 +05:30
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
0dea509817 Oops, add the missing #tap call 2009-12-29 15:54:40 +05:30
Pratik Naik
0a1ff1a14f Rewrite Relation#readonly, eager_load, preload using Object#tap 2009-12-29 15:28:40 +05:30
Pratik Naik
1785e1b26e Rename Relation#create_new_relation to spawn and refactor preload/eagerload associations using attr_writer 2009-12-29 15:24:30 +05:30
Pratik Naik
61fa111a55 Refactor Relation#readonly using attr_writer 2009-12-29 15:24:30 +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
13989ff8c6 Use relation#delete_all for Model.delete_all 2009-12-29 11:46:07 +05:30
Pratik Naik
54b80c7361 Add Relation#delete_all 2009-12-29 11:46:07 +05:30
Pratik Naik
08633bae5e Migrate all the calculation methods to Relation 2009-12-29 04:30:04 +05:30
Jeremy Kemper
ea7b5ff99e Use present rather than any 2009-12-28 12:12:53 -08:00
Pratik Naik
91e28aae86 Add Model.having and Relation#having 2009-12-29 00:07:46 +05:30
Pratik Naik
e8ca22d129 Move Relation calculation methods to a separate module 2009-12-28 19:12:15 +05:30
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
a3c1db4e44 Add Model.lock and relation#lock now that arel has locking 2009-12-28 12:42:06 +05:30
Pratik Naik
a0ff5f82c3 Dont delegate relation#find to to_a 2009-12-28 03:22:33 +05:30
Pratik Naik
e9e20ab601 Use arel#from instead of the current hack 2009-12-28 03:19:31 +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
08312e9958 Return a new relation when blank is supplied to relation.joins 2009-12-27 23:29:41 +05:30
Pratik Naik
bbdeaae2ca Add relation.destroy_all 2009-12-27 21:15:12 +05:30
Pratik Naik
5cd8818258 Make Model.destroy_all use new finders 2009-12-27 19:22:18 +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
a3f3fab795 Add relation.from as a temporary workaround until arel relation has .from option 2009-12-27 17:37:36 +05:30
Pratik Naik
6f5e3a04d6 Relation should supply :from to find_with_associations 2009-12-27 17:16:20 +05:30
Pratik Naik
d92c4a8402 Add find(ids) to relations 2009-12-27 16:15:29 +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
f374150698 Ensure Model.scoped adds type conditions for STI models 2009-12-27 00:11:31 +05:30
Pratik Naik
9a9f97af28 Add relation.reload to force reloading the records 2009-12-26 15:31:50 +05:30
Pratik Naik
3c5a7dcaf5 Cache the loaded relations 2009-12-26 15:07:00 +05:30
Pratik Naik
9d3d60c64a Ensure preload and eager_load finder methods accept multiple arguments 2009-12-26 14:40:45 +05:30
Pratik Naik
284d186cf4 Make sure the relations are always immutable 2009-12-26 14:26:02 +05:30
Pratik Naik
187fbe5cba Add support for multiple arguments to .where finder 2009-12-26 12:57:34 +05:30