Class: Pulitzer::PostType

Inherits:
ApplicationRecord show all
Defined in:
app/models/pulitzer/post_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

assoc_name, attrs_name, convert_hash_to_nested, convert_nested_assoc

Instance Attribute Details

#import_jsonObject

Returns the value of attribute import_json.



14
15
16
# File 'app/models/pulitzer/post_type.rb', line 14

def import_json
  @import_json
end

Class Method Details

.named(label) ⇒ Object



16
17
18
# File 'app/models/pulitzer/post_type.rb', line 16

def self.named(label)
  self.find_by(name: label)
end

Instance Method Details

#most_recent_published_post_type_versionObject



24
25
26
# File 'app/models/pulitzer/post_type.rb', line 24

def most_recent_published_post_type_version
  post_type_versions&.published&.order(version_number: :desc)&.first
end

#most_recent_version_numberObject



28
29
30
# File 'app/models/pulitzer/post_type.rb', line 28

def most_recent_version_number
  most_recent_published_post_type_version&.version_number
end

#published_type_version_idObject



20
21
22
# File 'app/models/pulitzer/post_type.rb', line 20

def published_type_version_id
  published_type_version&.id
end