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



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

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



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

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



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

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



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

def photo_url
  return nil unless photo.attached?

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