diff options
author | Tim Morgan <tim@timmorgan.org> | 2010-10-14 22:31:05 -0500 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-19 14:43:31 -0700 |
commit | b1b26af9a2f1c2037f7c2167d747ed33cc639763 (patch) | |
tree | 218444ecb0115b77dcc023511d5ea99d0b440644 /activerecord/test/models/post.rb | |
parent | d619b9d1d1ad8d7497bf24283b2318c056283f48 (diff) | |
download | rails-b1b26af9a2f1c2037f7c2167d747ed33cc639763.tar.gz rails-b1b26af9a2f1c2037f7c2167d747ed33cc639763.tar.bz2 rails-b1b26af9a2f1c2037f7c2167d747ed33cc639763.zip |
Allow default_scope to accept a Proc.
Diffstat (limited to 'activerecord/test/models/post.rb')
-rw-r--r-- | activerecord/test/models/post.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index a3cb9c724a..61e782ff14 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -113,3 +113,9 @@ class PostWithComment < ActiveRecord::Base self.table_name = 'posts' default_scope where("posts.comments_count > 0").order("posts.comments_count ASC") end + +class PostForAuthor < ActiveRecord::Base + self.table_name = 'posts' + cattr_accessor :selected_author + default_scope lambda { where(:author_id => PostForAuthor.selected_author) } +end |