Class: NoCms::Blocks::Block

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Concerns::SerializingFields, Concerns::TranslationScopes
Defined in:
app/models/no_cms/blocks/block.rb

Defined Under Namespace

Classes: Translation

Instance Method Summary collapse

Instance Method Details

#duplicate_self(new_self) ⇒ Object

A block dups all it’s children and the translations



25
26
27
28
29
30
31
32
33
# File 'app/models/no_cms/blocks/block.rb', line 25

def duplicate_self new_self

  new_self.translations = translations.map(&:dup)
  new_self.translations.each { |t| t.globalized_model = new_self }

  children.each do |child|
    new_self.children << child.dup
  end
end

#fields_configurationObject

In the block we get all the fields so it can accept all of them



17
18
19
# File 'app/models/no_cms/blocks/block.rb', line 17

def fields_configuration
  layout_config.fields
end