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

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

Instance Attribute Summary

Attributes inherited from Base

#abstract_model, #defined, #name, #order, #parent, #properties, #root, #section

Attributes included from Proxyable

#bindings

Instance Method Summary collapse

Methods inherited from Association

#associated_model_config, #associated_object_label_method, #associated_primary_key, #association, #foreign_key, inherited, #inverse_of, #polymorphic?, #value, #virtual?

Methods inherited from Base

#association?, #errors, #html_default_value, #initialize, #inspect, #inverse_of, #optional, #optional=, #optional?, #type, #type_css_class, #value, #virtual?

Methods included from Groupable

#group

Methods included from Hideable

#hidden?, #hide, included, #show

Methods included from Configurable

#has_option?, included, #register_deprecated_instance_option, #register_instance_option

Methods included from Proxyable

#with

Constructor Details

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

Instance Method Details

#editable?Boolean

Returns:



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

#multiple?Boolean

Returns:



32
33
34
# File 'lib/rails_admin/config/fields/types/has_one_association.rb', line 32

def multiple?
  false
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