Class: Museum::CaseDetail

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/museum/case_detail.rb

Class Method Summary collapse

Class Method Details

.detail(key) ⇒ Object



16
17
18
19
20
21
22
23
# File 'app/models/museum/case_detail.rb', line 16

def self.detail(key)
  detail = find_by_key(key)
  if detail.nil?
    raise 'Could not find ' + key
  else
    detail.value
  end
end

.find_all_by_loupe_slug(slug) ⇒ Object



12
13
14
# File 'app/models/museum/case_detail.rb', line 12

def self.find_all_by_loupe_slug(slug)
  where(museum_loupe_id: Loupe.id_by_slug(slug))
end

.follow(key) ⇒ Object



25
26
27
# File 'app/models/museum/case_detail.rb', line 25

def self.follow(key)
  detail(key).fetch('Accept' => 'application/vnd.github.html')
end

.update_or_create_by(args, attributes) ⇒ Object



8
9
10
# File 'app/models/museum/case_detail.rb', line 8

def self.update_or_create_by(args, attributes)
  self.find_or_create_by(args).update(attributes)
end