Class: Pulitzer::PostType
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Pulitzer::PostType
- Defined in:
- app/models/pulitzer/post_type.rb
Class Method Summary collapse
Instance Method Summary collapse
- #has_free_form_sections? ⇒ Boolean
- #has_templated_content_elements? ⇒ Boolean
- #singleton_post ⇒ Object
- #singleton_post? ⇒ Boolean
- #singular? ⇒ Boolean
Class Method Details
.named(label) ⇒ Object
14 15 16 |
# File 'app/models/pulitzer/post_type.rb', line 14 def self.named(label) self.find_by(name: label) end |
Instance Method Details
#has_free_form_sections? ⇒ Boolean
34 35 36 |
# File 'app/models/pulitzer/post_type.rb', line 34 def has_free_form_sections? free_form_section_types.any? end |
#has_templated_content_elements? ⇒ Boolean
30 31 32 |
# File 'app/models/pulitzer/post_type.rb', line 30 def has_templated_content_elements? content_element_types.any? end |
#singleton_post ⇒ Object
22 23 24 |
# File 'app/models/pulitzer/post_type.rb', line 22 def singleton_post posts.first end |
#singleton_post? ⇒ Boolean
26 27 28 |
# File 'app/models/pulitzer/post_type.rb', line 26 def singleton_post? !!singleton_post end |
#singular? ⇒ Boolean
18 19 20 |
# File 'app/models/pulitzer/post_type.rb', line 18 def singular? !plural end |