From 1a4534756f187e6e0a8b403853008570f06e5df3 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Sun, 18 May 2014 15:56:08 -0300 Subject: [PATCH] adding newer_than and older_then named scopes --- app/models/profile.rb | 10 ++++++++++ 1 file changed, 10 insertions(+), 0 deletions(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index 5bceef5..96930dc 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -81,6 +81,16 @@ class Profile < ActiveRecord::Base named_scope :templates, {:conditions => {:is_template => true}} named_scope :no_templates, {:conditions => {:is_template => false}} + #FIXME make this test + named_scope :newer_than, lambda { |reference_id| + {:conditions => ["profiles.id > #{reference_id}"]} + } + + #FIXME make this test + named_scope :older_than, lambda { |reference_id| + {:conditions => ["profiles.id < #{reference_id}"]} + } + def members scopes = plugins.dispatch_scopes(:organization_members, self) scopes << Person.members_of(self) -- libgit2 0.21.2