From b5a483087102f6e0e44f18eaa36cee7364083f08 Mon Sep 17 00:00:00 2001 From: kikito Date: Wed, 30 Sep 2015 20:53:57 +0200 Subject: [PATCH] Adds User.by_document scope --- app/models/user.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/user.rb b/app/models/user.rb index dd8c725be..b24354fa2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -40,6 +40,7 @@ class User < ActiveRecord::Base scope :organizations, -> { joins(:organization) } scope :officials, -> { where("official_level > 0") } scope :for_render, -> { includes(:organization) } + scope :by_document, -> (document_type, document_number) { where(document_type: document_type, document_number: document_number) } def self.find_for_oauth(auth, signed_in_resource = nil) # Get the identity and user if they exist