Class: Primer::Forms::Dsl::FormReferenceInput
- Defined in:
 - lib/primer/forms/dsl/form_reference_input.rb
 
Overview
:nodoc:
Constant Summary
Constants inherited from Input
Input::DEFAULT_SIZE, Input::SIZE_MAPPINGS, Input::SIZE_OPTIONS, Input::SPACE_DELIMITED_ARIA_ATTRIBUTES
Instance Attribute Summary collapse
- 
  
    
      #fields_for_args  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute fields_for_args.
 - 
  
    
      #fields_for_kwargs  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute fields_for_kwargs.
 - 
  
    
      #nested  ⇒ Object 
    
    
      (also: #nested?)
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute nested.
 - 
  
    
      #ref_block  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute ref_block.
 
Attributes inherited from Input
#base_id, #builder, #caption, #form, #form_control, #ids, #input_arguments, #label_arguments, #validation_message
Instance Method Summary collapse
- 
  
    
      #initialize(*fields_for_args, builder:, form:, nested: true, **fields_for_kwargs, &block)  ⇒ FormReferenceInput 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
For situations like this where an association exists between two models, the nested attributes approach works great.
 - #label ⇒ Object
 - #name ⇒ Object
 - #to_component ⇒ Object
 - #type ⇒ Object
 
Methods inherited from Input
#add_input_aria, #add_input_classes, #add_input_data, #add_label_classes, #autofocus!, #caption?, #caption_id, #caption_template?, #disabled?, #focusable?, #full_width?, #hidden?, #input?, #invalid?, #merge_input_arguments!, #remove_input_data, #render_caption_template, #required?, #size, #valid?, #validation_arguments, #validation_error_icon_target, #validation_id, #validation_message_arguments, #validation_messages, #validation_success_icon_target
Methods included from ClassNameHelper
Constructor Details
#initialize(*fields_for_args, builder:, form:, nested: true, **fields_for_kwargs, &block) ⇒ FormReferenceInput
For situations like this where an association exists between two models, the nested attributes approach works great. However sometimes all you want is to compose two forms together that aren’t connected by an association. In such cases the fields will still include the name of the parent model, eg. ‘user[street]` instead of what we want, `address`. To render the form independent of the parent, pass `nested: false`.
      32 33 34 35 36 37 38 39  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 32 def initialize(*fields_for_args, builder:, form:, nested: true, **fields_for_kwargs, &block) @fields_for_args = fields_for_args @fields_for_kwargs = fields_for_kwargs @nested = nested @ref_block = block super(builder: builder, form: form, **fields_for_kwargs) end  | 
  
Instance Attribute Details
#fields_for_args ⇒ Object (readonly)
Returns the value of attribute fields_for_args.
      8 9 10  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 8 def fields_for_args @fields_for_args end  | 
  
#fields_for_kwargs ⇒ Object (readonly)
Returns the value of attribute fields_for_kwargs.
      8 9 10  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 8 def fields_for_kwargs @fields_for_kwargs end  | 
  
#nested ⇒ Object (readonly) Also known as: nested?
Returns the value of attribute nested.
      8 9 10  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 8 def nested @nested end  | 
  
#ref_block ⇒ Object (readonly)
Returns the value of attribute ref_block.
      8 9 10  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 8 def ref_block @ref_block end  | 
  
Instance Method Details
#label ⇒ Object
      49 50 51  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 49 def label nil end  | 
  
#name ⇒ Object
      45 46 47  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 45 def name nil end  | 
  
#to_component ⇒ Object
      41 42 43  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 41 def to_component FormReference.new(input: self) end  | 
  
#type ⇒ Object
      53 54 55  | 
    
      # File 'lib/primer/forms/dsl/form_reference_input.rb', line 53 def type :form end  |