Sha256: 2f247d7edcd4e474093548e1a380b60385a04b43c78bb0b0132b7bd4c40e18d4
Contents?: true
Size: 736 Bytes
Versions: 1
Compression:
Stored size: 736 Bytes
Contents
module Museum class CaseDetail < ActiveRecord::Base validates_presence_of :key, :case, :loupe belongs_to :case, class_name: 'Museum::Case', foreign_key: :museum_case_id belongs_to :loupe, class_name: 'Museum::Loupe', foreign_key: :museum_loupe_id def self.update_or_create_by(args, attributes) self.find_or_create_by(args).update(attributes) end def self.find_all_by_loupe_slug(slug) where(museum_loupe_id: Loupe.id_by_slug(slug)) end def self.detail(key) detail = find_by_key(key) if detail.nil? nil else detail.value end end def self.follow(key) detail(key).fetch('Media-Type' => 'application/vnd.github.html') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
museum-0.1.4 | app/models/museum/case_detail.rb |