Commit 1a4534756f187e6e0a8b403853008570f06e5df3

Authored by Leandro Santos
1 parent 04e70290

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
... ... @@ -81,6 +81,16 @@ class Profile < ActiveRecord::Base
81 81 named_scope :templates, {:conditions => {:is_template => true}}
82 82 named_scope :no_templates, {:conditions => {:is_template => false}}
83 83  
  84 + #FIXME make this test
  85 + named_scope :newer_than, lambda { |reference_id|
  86 + {:conditions => ["profiles.id > #{reference_id}"]}
  87 + }
  88 +
  89 + #FIXME make this test
  90 + named_scope :older_than, lambda { |reference_id|
  91 + {:conditions => ["profiles.id < #{reference_id}"]}
  92 + }
  93 +
84 94 def members
85 95 scopes = plugins.dispatch_scopes(:organization_members, self)
86 96 scopes << Person.members_of(self)
... ...