From 72b21368f8af57d260827d2e947accb66b3799a2 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 fc605a7..9d9f695 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -88,6 +88,16 @@ class Profile < ActiveRecord::Base scope :templates, {:conditions => {:is_template => true}} 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