Sha256: aecac0232a2497e540cfeb934f0a9d86e995d295d2b9324bda53a6be4a076439
Contents?: true
Size: 1 KB
Versions: 5
Compression:
Stored size: 1 KB
Contents
require 'rails_admin/config/fields/association' module RailsAdmin module Config module Fields module Types class HasManyAssociation < RailsAdmin::Config::Fields::Association # Register field type for the type loader RailsAdmin::Config::Fields::Types.register(self) register_instance_option :partial do nested_form ? :form_nested_many : :form_filtering_multiselect end # orderable associated objects register_instance_option :orderable do false end def method_name nested_form ? "#{name}_attributes".to_sym : super end # Reader for validation errors of the bound object def errors bindings[:object].errors[name] end def associated_prepopulate_params {associated_model_config.abstract_model.param_key => {association.foreign_key => bindings[:object].try(:id)}} end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems