Commit Graph

690 Commits

Author SHA1 Message Date
Pratik Naik
b35873a575 Rename Model.arel_table to Model.active_relation 2010-01-02 00:25:29 +05:30
Pratik Naik
d2c4b3b672 Rename Model.engine to active_relation_engine. Cache arel_table and the method takes no arguments now 2010-01-02 00:03:20 +05:30
Pratik Naik
d200d08004 Use arel for building the STI type condition 2010-01-01 23:15:48 +05:30
Pratik Naik
77c23b2104 Use PredicateBuilder for sql hash sanitization 2010-01-01 04:17:56 +05:30
Pratik Naik
d5f9173926 Add Relation#delete [Pratik Naik, Emilio Tagua] 2010-01-01 00:17:40 +05:30
José Valim
4ecdf24bde Kick AR logging back to life and move ControllerRuntime inside ActiveRecord::Rails. 2009-12-30 13:07:48 +01:00
Pratik Naik
3b8853eda4 Replace Base#safe_to_array with Array.wrap 2009-12-29 15:53:06 +05:30
Pratik Naik
13989ff8c6 Use relation#delete_all for Model.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
Pratik Naik
91e28aae86 Add Model.having and Relation#having 2009-12-29 00:07:46 +05:30
Pratik Naik
aefa975fdd Remove the todo note for arel#lock 2009-12-28 16:20:40 +05:30
Pratik Naik
02207dc02c Add Model.readonly and association_collection#readonly finder method 2009-12-28 16:17:46 +05:30
Pratik Naik
5156507e13 Remove locking related unused code 2009-12-28 14:33:56 +05:30
Pratik Naik
9f4e98330b Remove unused construct_finder_sql 2009-12-28 12:57:35 +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
1c26ba486c Add Model.from and association_collection#from finder methods 2009-12-28 03:59:44 +05:30
Pratik Naik
6a776dcc9d Use relation.from when constructing a relation 2009-12-28 03:59:44 +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
352cc7c94a Make Model.find(:last) use relations 2009-12-27 19:12:50 +05:30
Pratik Naik
8957f5db5d Make Model.all just a wrapper for find(:all) 2009-12-27 18:32:10 +05:30
Pratik Naik
d6d0fe8c8f Make Model.find(:first, ..) use relations 2009-12-27 18:28:59 +05:30
Pratik Naik
59cf5e7bf2 Make Model.exists? use relation.exists? 2009-12-27 18:10:26 +05:30
Pratik Naik
b31233485b Make Model.find(:all) use relations 2009-12-27 17:43:31 +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
7b5d0e8b78 Make Model.find(ids) use relations 2009-12-27 16:56:10 +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
1efc8edb5f Fix dynamic finder docs 2009-12-27 14:50:33 +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
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
c6258ee313 Ensure all the finder methods respect scoping 2009-12-26 19:15:05 +05:30
Pratik Naik
95274b28d9 Rename Model.conditions and relation.conditions to .where 2009-12-26 03:50:57 +05:30
Pratik Naik
a7fd564ab1 Add Model.select/group/order/limit/joins/conditions/preload/eager_load class methods returning a lazy relation.
Examples :

    posts = Post.select('id).order('name') # Returns a lazy relation
    posts.each {|p| puts p.id } # Fires "select id from posts order by name"
2009-12-26 03:06:51 +05:30
Gabe da Silveira
32395899d7 Replace reset_counter_cache with reset_counters that has API inline with existing update_counters method
[#1211 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-03 23:25:11 -08:00
Mike Breen
50c28e78c7 Implement ActiveRecord#reset_counter_cache
[#1211 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-02 12:20:00 -08:00
Jeremy Kemper
7b3d85db4c Revert "Split arel_table into method to get a relation and another to memoize the default relation."
This reverts commit bd51790895.
2009-11-13 15:30:51 -08:00
Jeremy Kemper
bd51790895 Split arel_table into method to get a relation and another to memoize the default relation. 2009-11-13 10:53:19 -08:00
Xavier Noria
1979e9c855 Symbol#to_proc is not needed for Ruby >= 1.8.7 2009-11-09 22:16:51 +01:00
José Valim
e714b499cc Move validator, human_name and human_attribute_name to ActiveModel, remove deprecated error messages and add i18n_scope and lookup_ancestors.
Signed-off-by: Carl Lerche <carllerche@mac.com>
2009-10-20 17:52:32 -07:00
Eric Chapweske
f936a1f100 Refactoring attributes/types [#3348 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-17 12:37:15 -05:00
José Valim
a15e02d44a Unify benchmark APIs. 2009-10-15 18:19:25 -03:00
José Valim
af0d1fa892 Update Orchestra instrumentations and move part of logging to Orchestra. 2009-10-15 18:18:44 -03:00
Emilio Tagua
aadb09b13b Merge commit 'rails/master' 2009-10-07 12:23:23 -03:00
Emilio Tagua
f13a7bf4e1 Don't send table_name when updating attributes, use the class arel_table. 2009-10-07 12:21:52 -03:00
Emilio Tagua
942d4b2e4f Don't send table_name when there's no need to. 2009-10-07 12:17:51 -03:00
Paul Gillard
6361d4234c Call initialize_copy when cloning [#3164 state:resolved]
Cloned AR objects are now instantiated through initialize_copy rather than
new/initialize. This allows AR classes to override initialize_copy in order to
implement deep cloning.

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-06 16:25:51 -05:00
Emilio Tagua
23c168a4fd Initial documentation to Base#all. 2009-10-05 15:27:40 -03:00
Emilio Tagua
1daceeb838 Merge branch 'associations_2' 2009-10-05 15:25:06 -03:00
Emilio Tagua
65f055a3ed Added eager loading support to Relation and ActiveRecord#all. 2009-10-05 15:24:08 -03:00
Emilio Tagua
3747f896a1 Moved relation's test to relation_test. 2009-10-05 14:39:20 -03:00