Class: Dscf::Marketplace::Agent

Inherits:
ApplicationRecord show all
Defined in:
app/models/dscf/marketplace/agent.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ransackable_associations(_auth_object = nil) ⇒ Object



41
42
43
# File 'app/models/dscf/marketplace/agent.rb', line 41

def self.ransackable_associations(_auth_object = nil)
  %w[onboarded_by photo_attachment photo_blob national_id_attachment national_id_blob]
end

.ransackable_attributes(_auth_object = nil) ⇒ Object

Ransack



35
36
37
38
39
# File 'app/models/dscf/marketplace/agent.rb', line 35

def self.ransackable_attributes(_auth_object = nil)
  %w[id code name phone service_area sub_city woreda status fayda_number
     verification_status rejection_reason rejected_at modified_at gender
     onboarded_by_id created_at updated_at]
end

Instance Method Details

#national_id_urlObject



51
52
53
54
55
# File 'app/models/dscf/marketplace/agent.rb', line 51

def national_id_url
  return nil unless national_id.attached?

  Rails.application.routes.url_helpers.rails_blob_url(national_id, only_path: true)
end

#photo_urlObject



45
46
47
48
49
# File 'app/models/dscf/marketplace/agent.rb', line 45

def photo_url
  return nil unless photo.attached?

  Rails.application.routes.url_helpers.rails_blob_url(photo, only_path: true)
end