diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-08-02 21:22:02 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-03 10:46:09 +0200 |
commit | db1c484c55758e25c56615d6efdab8a22cff4a46 (patch) | |
tree | af503c701b24e8e4150e1fb7b4c32b057d04e7b1 | |
parent | 807239f5a191205080b43c8d7316d4de60b13f6b (diff) | |
download | rails-db1c484c55758e25c56615d6efdab8a22cff4a46.tar.gz rails-db1c484c55758e25c56615d6efdab8a22cff4a46.tar.bz2 rails-db1c484c55758e25c56615d6efdab8a22cff4a46.zip |
Dynamic finder method like scoped_by_* create methods so that
method_missing is not hit next time. Adding a test for this
scenario.
Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r-- | activerecord/test/cases/named_scope_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb index 7c037b20c5..c42dda2ccb 100644 --- a/activerecord/test/cases/named_scope_test.rb +++ b/activerecord/test/cases/named_scope_test.rb @@ -478,4 +478,10 @@ class DynamicScopeTest < ActiveRecord::TestCase assert_equal Post.scoped_by_author_id(1).find(1), Post.find(1) assert_equal Post.scoped_by_author_id_and_title(1, "Welcome to the weblog").first, Post.find(:first, :conditions => { :author_id => 1, :title => "Welcome to the weblog"}) end + + def test_dynamic_scope_should_create_methods_after_hitting_method_missing + assert Developer.methods.grep(/scoped_by_created_at/).blank? + Developer.scoped_by_created_at(nil) + assert Developer.methods.grep(/scoped_by_created_at/).present? + end end |