Class: MarkdownRecord::Base

Inherits:
Object
  • Object
show all
Includes:
ActiveAttr::Model, Associations
Defined in:
app/models/markdown_record/base.rb

Direct Known Subclasses

ContentFragment

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Associations

#children, #class_siblings, #fragment, #siblings

Methods included from PathUtilities

#base_content_root_name, #base_rendered_path, #base_rendered_root, #clean_path, #erb_locals_from_path, #fragment_attributes_from_path, #full_path_to_parts, #path_to_fragment_id, #remove_prefix, #rendered_path, #scoped_id_to_parts, #to_scoped_id

Class Method Details

.json_klassObject



23
24
25
# File 'app/models/markdown_record/base.rb', line 23

def self.json_klass
  name.underscore
end

.new_association(base_filters = {}, search_filters = {}) ⇒ Object



15
16
17
# File 'app/models/markdown_record/base.rb', line 15

def self.new_association(base_filters = {}, search_filters = {})
  MarkdownRecord::Association.new(base_filters, search_filters)
end

Instance Method Details

#fragment_idObject



19
20
21
# File 'app/models/markdown_record/base.rb', line 19

def fragment_id
  Pathname.new(subdirectory).join(filename).to_s
end

#model_nameObject



27
28
29
# File 'app/models/markdown_record/base.rb', line 27

def model_name
  OpenStruct.new param_key: type
end

#to_keyObject



31
32
33
# File 'app/models/markdown_record/base.rb', line 31

def to_key
  scope.nil? ? [id] : ["#{scope}::id"]
end