Sha256: e9c8ee12a0a266fa276e3bb49a07f48b88c976ed712952f0779105ec5738f2e2
Contents?: true
Size: 786 Bytes
Versions: 1
Compression:
Stored size: 786 Bytes
Contents
require 'rails_admin/config/fields/association' module RailsAdmin module Config module Fields module Types class HasOneAssociation < RailsAdmin::Config::Fields::Association # Register field type for the type loader RailsAdmin::Config::Fields::Types::register(self) register_instance_option(:partial) do :form_filtering_select end # Accessor for field's formatted value register_instance_option(:formatted_value) do (o = value) && o.send(associated_model_config.object_label_method) end def selected_id value.try :id end def method_name "#{name}_id" end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
elucid-rails_admin-0.0.1 | lib/rails_admin/config/fields/types/has_one_association.rb |