Commit 72b21368f8af57d260827d2e947accb66b3799a2
1 parent
ded7ef77
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
adding newer_than and older_then named scopes
Showing
1 changed file
with
10 additions
and
0 deletions
Show diff stats
app/models/profile.rb
| ... | ... | @@ -88,6 +88,16 @@ class Profile < ActiveRecord::Base |
| 88 | 88 | scope :templates, {:conditions => {:is_template => true}} |
| 89 | 89 | scope :no_templates, {:conditions => {:is_template => false}} |
| 90 | 90 | |
| 91 | + #FIXME make this test | |
| 92 | + named_scope :newer_than, lambda { |reference_id| | |
| 93 | + {:conditions => ["profiles.id > #{reference_id}"]} | |
| 94 | + } | |
| 95 | + | |
| 96 | + #FIXME make this test | |
| 97 | + named_scope :older_than, lambda { |reference_id| | |
| 98 | + {:conditions => ["profiles.id < #{reference_id}"]} | |
| 99 | + } | |
| 100 | + | |
| 91 | 101 | def members |
| 92 | 102 | scopes = plugins.dispatch_scopes(:organization_members, self) |
| 93 | 103 | scopes << Person.members_of(self) | ... | ... |