class SimpleForm::FormBuilder

def build_association_attribute(reflection, association, options)

Experimental RBS support (using type sampling data from the type_fusion project).

def build_association_attribute: (ActiveRecord::Reflection::BelongsToReflection reflection, Symbol association, Hash options) -> untyped

This signature was generated using 1 sample from 1 application.

def build_association_attribute(reflection, association, options)
  case reflection.macro
  when :belongs_to
    (reflection.respond_to?(:options) && reflection.options[:foreign_key]) || :"#{reflection.name}_id"
  when :has_one
    raise ArgumentError, ":has_one associations are not supported by f.association"
  else
    if options[:as] == :select || options[:as] == :grouped_select
      html_options = options[:input_html] ||= {}
      html_options[:multiple] = true unless html_options.key?(:multiple)
    end
    # Force the association to be preloaded for performance.
    if options[:preload] != false && object.respond_to?(association)
      target = object.send(association)
      target.to_a if target.respond_to?(:to_a)
    end
    :"#{reflection.name.to_s.singularize}_ids"
  end
end