Class: Pulitzer::ApplicationRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Pulitzer::ApplicationRecord
show all
- Defined in:
- app/models/pulitzer/application_record.rb
Direct Known Subclasses
ArrangementStyle, BackgroundStyle, ContentElement, ContentElementType, CustomOption, CustomOptionList, FreeFormSection, FreeFormSectionType, JustificationStyle, Partial, PartialTag, PartialType, Post, PostTag, PostType, PostTypeContentElementType, PostTypeVersion, SequenceFlowStyle, Style, Tag, Version
Class Method Summary
collapse
Class Method Details
.assoc_name ⇒ Object
4
5
6
|
# File 'app/models/pulitzer/application_record.rb', line 4
def self.assoc_name
@assoc_name ||= name.demodulize.underscore.pluralize
end
|
.attrs_name ⇒ Object
8
9
10
|
# File 'app/models/pulitzer/application_record.rb', line 8
def self.attrs_name
@attrs_name ||= assoc_name + '_attributes'
end
|
.convert_hash_to_nested(json_hash) ⇒ Object
12
13
14
15
16
17
18
|
# File 'app/models/pulitzer/application_record.rb', line 12
def self.convert_hash_to_nested(json_hash)
if json_hash.has_key? assoc_name
json_hash[attrs_name] = json_hash[assoc_name]
json_hash.delete assoc_name
end
convert_nested_assoc json_hash
end
|
.convert_nested_assoc(json_hash) ⇒ Object
20
21
22
|
# File 'app/models/pulitzer/application_record.rb', line 20
def self.convert_nested_assoc(json_hash)
json_hash
end
|