Class: Locomotive::Mounter::Models::EditableElement

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/mounter/models/editable_element.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#_id, #created_at, #mounting_point, #updated_at

Instance Method Summary collapse

Methods inherited from Base

#initialize, #persisted?

Methods included from Fields

#[], #attributes, #attributes_with_translations, #initialize, #localized_field?, #to_hash, #translated_in, #translated_in?, #write_attributes

Constructor Details

This class inherits a constructor from Locomotive::Mounter::Models::Base

Instance Attribute Details

#blockObject

other accessors



11
12
13
# File 'lib/locomotive/mounter/models/editable_element.rb', line 11

def block
  @block
end

#slugObject

other accessors



11
12
13
# File 'lib/locomotive/mounter/models/editable_element.rb', line 11

def slug
  @slug
end

Instance Method Details

#contentObject

fields ##



8
# File 'lib/locomotive/mounter/models/editable_element.rb', line 8

field :content, localized: true

#to_paramsObject

methods ##



15
16
17
# File 'lib/locomotive/mounter/models/editable_element.rb', line 15

def to_params
  { block: self.block, slug: self.slug, content: self.content }
end

#to_yamlObject



19
20
21
# File 'lib/locomotive/mounter/models/editable_element.rb', line 19

def to_yaml
  { "#{block}/#{slug}" => content }
end