merges with master
This commit is contained in:
@@ -3,7 +3,7 @@ module Taggable
|
||||
|
||||
included do
|
||||
acts_as_taggable
|
||||
validate :max_number_of_tags
|
||||
validate :max_number_of_tags, on: :create
|
||||
end
|
||||
|
||||
def tag_list_with_limit(limit = nil)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
class Manager < ActiveRecord::Base
|
||||
validates :username, presence: true, uniqueness: true
|
||||
validates :password_digest, presence: true
|
||||
|
||||
has_secure_password
|
||||
|
||||
def self.valid_manager(username = nil, password = nil)
|
||||
return false unless username.present? && password.present?
|
||||
Manager.find_by(username: username).try(:authenticate, password)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
class Verification::Management::Document
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Dates
|
||||
|
||||
attr_accessor :document_type
|
||||
attr_accessor :document_number
|
||||
@@ -17,7 +18,21 @@ class Verification::Management::Document
|
||||
end
|
||||
|
||||
def in_census?
|
||||
CensusApi.new.call(document_type, document_number).valid?
|
||||
response = CensusApi.new.call(document_type, document_number)
|
||||
response.valid? && valid_age?(response)
|
||||
end
|
||||
|
||||
def valid_age?(response)
|
||||
if under_sixteen?(response)
|
||||
errors.add(:age, true)
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
def under_sixteen?(response)
|
||||
16.years.ago < string_to_date(response.date_of_birth)
|
||||
end
|
||||
|
||||
def verified?
|
||||
@@ -28,7 +43,4 @@ class Verification::Management::Document
|
||||
user.update(verified_at: Time.now) if user?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user