diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-22 20:10:29 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-22 20:10:41 +0530 |
commit | ee8c006dac7d76f79fb43df97a4ab8a2ae87b8b2 (patch) | |
tree | 8da7c10f9e96a23e77ab926c28cccb639b6f6267 /activerecord/lib | |
parent | c52820ae1550c5e4d3b616c7354ea2c877c24e62 (diff) | |
download | rails-ee8c006dac7d76f79fb43df97a4ab8a2ae87b8b2.tar.gz rails-ee8c006dac7d76f79fb43df97a4ab8a2ae87b8b2.tar.bz2 rails-ee8c006dac7d76f79fb43df97a4ab8a2ae87b8b2.zip |
Allow calling class methods on a Relation
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 04b85119cb..fa99e3f891 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -301,6 +301,8 @@ module ActiveRecord def method_missing(method, *args, &block) if Array.method_defined?(method) to_a.send(method, *args, &block) + elsif @klass.respond_to?(method) + @klass.send(:with_scope, self) { @klass.send(method, *args, &block) } elsif arel.respond_to?(method) arel.send(method, *args, &block) elsif match = DynamicFinderMatch.match(method) |