Class: RailsAdmin::Config::Fields::Types::HasOneAssociation

Inherits:
Association show all
Defined in:
lib/rails_admin/config/fields/types/has_one_association.rb

Instance Attribute Summary

Attributes inherited from Base

#defined, #name, #order, #properties, #section

Attributes inherited from Base

#abstract_model, #bindings, #parent, #root

Instance Method Summary collapse

Methods inherited from Association

#associated_label_method, #associated_model_config, #association, #child_key, #errors, inherited, #inverse_of, #polymorphic?, #value

Methods inherited from Base

#_html_attributes, #association?, #errors, inherited, #initialize, #inverse_of, #nested_form, #optional, #optional=, #optional?, #render, #type, #type_css_class, #value, #virtual?

Methods included from Hideable

#hidden?, #hide, included, #show

Methods inherited from Base

#has_option?, #initialize, register_class_option, #register_deprecated_instance_option, register_deprecated_instance_option, #register_instance_option, register_instance_option, #with

Constructor Details

This class inherits a constructor from RailsAdmin::Config::Fields::Base

Instance Method Details

#editableObject



20
21
22
# File 'lib/rails_admin/config/fields/types/has_one_association.rb', line 20

def editable
  (nested_form || abstract_model.model.new.respond_to?("#{self.name}_id=")) && super
end

#method_nameObject



28
29
30
# File 'lib/rails_admin/config/fields/types/has_one_association.rb', line 28

def method_name
  nested_form ? "#{self.name}_attributes" : "#{self.name}_id"
end

#selected_idObject



24
25
26
# File 'lib/rails_admin/config/fields/types/has_one_association.rb', line 24

def selected_id
  value.try :id
end