Class: ActiveAdmin::Cms::Recipe::Section

Inherits:
Object
  • Object
show all
Includes:
ActiveAdmin::Cms::Recipes::SectionHelper::SectionContainer
Defined in:
lib/active_admin/cms/recipe/section.rb

Instance Attribute Summary collapse

Attributes included from ActiveAdmin::Cms::Recipes::SectionHelper::SectionContainer

#parent

Instance Method Summary collapse

Methods included from ActiveAdmin::Cms::Recipes::SectionHelper::SectionContainer

#add_fields_to, #admin_fieldset_title, #ingredient, #ingredients, #method_missing, #section_id, #section_key, #sections

Constructor Details

#initialize(id, opts = {}, &block) ⇒ Section

Returns a new instance of Section.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/active_admin/cms/recipe/section.rb', line 12

def initialize(id, opts={}, &block)
  
  #debugger

  opts[:partial] ||= 'cms/recipes/section'
  opts[:class] ||= ''
  
  @id = id
  @options = opts

  if block
    self.instance_eval &block
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveAdmin::Cms::Recipes::SectionHelper::SectionContainer

Instance Attribute Details

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/active_admin/cms/recipe/section.rb', line 8

def id
  @id
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/active_admin/cms/recipe/section.rb', line 8

def options
  @options
end

Instance Method Details

#section(id, opts = {}, &block) ⇒ Object



27
28
29
30
31
# File 'lib/active_admin/cms/recipe/section.rb', line 27

def section(id, opts={}, &block)
  #super(id, opts)
  super
  sections[id].parent = self
end