Class: ActiveAdmin::HasManyBuilder
- Inherits:
 - 
      SimpleDelegator
      
        
- Object
 - SimpleDelegator
 - ActiveAdmin::HasManyBuilder
 
 
- Defined in:
 - lib/active_admin/form_builder.rb
 
Overview
Decorates a FormBuilder with the additional attributes and methods to build a has_many block. Nested has_many blocks are handled by nested decorators.
Instance Attribute Summary collapse
- 
  
    
      #assoc  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute assoc.
 - 
  
    
      #destroy_option  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute destroy_option.
 - 
  
    
      #heading  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute heading.
 - 
  
    
      #new_record  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute new_record.
 - 
  
    
      #options  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute options.
 - 
  
    
      #remove_record  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute remove_record.
 - 
  
    
      #sortable_column  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute sortable_column.
 - 
  
    
      #sortable_start  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute sortable_start.
 
Instance Method Summary collapse
- 
  
    
      #initialize(has_many_form, assoc, options)  ⇒ HasManyBuilder 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of HasManyBuilder.
 - #render(&block) ⇒ Object
 
Constructor Details
#initialize(has_many_form, assoc, options) ⇒ HasManyBuilder
Returns a new instance of HasManyBuilder.
      46 47 48 49 50 51 52 53 54 55 56  | 
    
      # File 'lib/active_admin/form_builder.rb', line 46 def initialize(has_many_form, assoc, ) super has_many_form @assoc = assoc @options = extract_custom_settings!(.dup) @options.reverse_merge!(for: assoc) @options[:class] = [[:class], "inputs has_many_fields"].compact.join(" ") if sortable_column @options[:for] = [assoc, sorted_children(sortable_column)] end end  | 
  
Instance Attribute Details
#assoc ⇒ Object (readonly)
Returns the value of attribute assoc.
      41 42 43  | 
    
      # File 'lib/active_admin/form_builder.rb', line 41 def assoc @assoc end  | 
  
#destroy_option ⇒ Object (readonly)
Returns the value of attribute destroy_option.
      44 45 46  | 
    
      # File 'lib/active_admin/form_builder.rb', line 44 def destroy_option @destroy_option end  | 
  
#heading ⇒ Object (readonly)
Returns the value of attribute heading.
      43 44 45  | 
    
      # File 'lib/active_admin/form_builder.rb', line 43 def heading @heading end  | 
  
#new_record ⇒ Object (readonly)
Returns the value of attribute new_record.
      44 45 46  | 
    
      # File 'lib/active_admin/form_builder.rb', line 44 def new_record @new_record end  | 
  
#options ⇒ Object (readonly)
Returns the value of attribute options.
      42 43 44  | 
    
      # File 'lib/active_admin/form_builder.rb', line 42 def @options end  | 
  
#remove_record ⇒ Object (readonly)
Returns the value of attribute remove_record.
      44 45 46  | 
    
      # File 'lib/active_admin/form_builder.rb', line 44 def remove_record @remove_record end  | 
  
#sortable_column ⇒ Object (readonly)
Returns the value of attribute sortable_column.
      43 44 45  | 
    
      # File 'lib/active_admin/form_builder.rb', line 43 def sortable_column @sortable_column end  | 
  
#sortable_start ⇒ Object (readonly)
Returns the value of attribute sortable_start.
      43 44 45  | 
    
      # File 'lib/active_admin/form_builder.rb', line 43 def sortable_start @sortable_start end  | 
  
Instance Method Details
#render(&block) ⇒ Object
      58 59 60 61 62 63 64 65  | 
    
      # File 'lib/active_admin/form_builder.rb', line 58 def render(&block) html = "".html_safe html << template.content_tag(:h3) { heading } if heading.present? html << template.capture { content_has_many(&block) } html = wrap_div_or_li(html) template.concat(html) if template.output_buffer html end  |