optimize census call to return after finding a valid element
This commit is contained in:
@@ -60,9 +60,10 @@ class Signature < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def in_census?
|
def in_census?
|
||||||
document_types.any? do |document_type|
|
response = document_types.detect do |document_type|
|
||||||
CensusApi.new.call(document_type, document_number).valid?
|
CensusApi.new.call(document_type, document_number).valid?
|
||||||
end
|
end
|
||||||
|
response.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_user
|
def set_user
|
||||||
|
|||||||
Reference in New Issue
Block a user