Commit 691617befa395635853d5ef9605a4039c07922a5
Committed by
Rodrigo Souto
1 parent
1c0b3ceb
Exists in
api_tasks
and in
4 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
@@ -99,6 +99,16 @@ class Profile < ActiveRecord::Base | @@ -99,6 +99,16 @@ class Profile < ActiveRecord::Base | ||
99 | } | 99 | } |
100 | scope :no_templates, {:conditions => {:is_template => false}} | 100 | scope :no_templates, {:conditions => {:is_template => false}} |
101 | 101 | ||
102 | + #FIXME make this test | ||
103 | + named_scope :newer_than, lambda { |reference_id| | ||
104 | + {:conditions => ["profiles.id > #{reference_id}"]} | ||
105 | + } | ||
106 | + | ||
107 | + #FIXME make this test | ||
108 | + named_scope :older_than, lambda { |reference_id| | ||
109 | + {:conditions => ["profiles.id < #{reference_id}"]} | ||
110 | + } | ||
111 | + | ||
102 | def members | 112 | def members |
103 | scopes = plugins.dispatch_scopes(:organization_members, self) | 113 | scopes = plugins.dispatch_scopes(:organization_members, self) |
104 | scopes << Person.members_of(self) | 114 | scopes << Person.members_of(self) |