Class: RailsAdmin::Config::Fields::Types::BelongsToAssociation

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

Direct Known Subclasses

PolymorphicAssociation

Constant Summary

Constants inherited from Base

Base::NAMED_INSTANCE_VARIABLES

Instance Attribute Summary

Attributes inherited from Base

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

Instance Method Summary collapse

Methods inherited from Association

#associated_model_config, #associated_model_limit, #associated_object_label_method, #association, #foreign_key, inherited, #polymorphic?, #value, #virtual?

Methods inherited from Base

#association?, #editable?, #errors, #form_default_value, #form_value, #generic_field_help, #generic_help, #initialize, #inverse_of, #optional, #optional=, #optional?, #parse_input, #parse_value, #type, #type_css_class, #value, #virtual?

Methods included from Inspectable

#inspect

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

#bindings, #bindings=, #with

Constructor Details

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

Instance Method Details

#associated_primary_keyObject



38
39
40
# File 'lib/rails_admin/config/fields/types/belongs_to_association.rb', line 38

def associated_primary_key
  @associated_primary_key ||= association.primary_key
end

#method_nameObject



46
47
48
# File 'lib/rails_admin/config/fields/types/belongs_to_association.rb', line 46

def method_name
  nested_form ? "#{name}_attributes".to_sym : association.foreign_key
end

#multiple?Boolean

Returns:



50
51
52
# File 'lib/rails_admin/config/fields/types/belongs_to_association.rb', line 50

def multiple?
  false
end

#selected_idObject



42
43
44
# File 'lib/rails_admin/config/fields/types/belongs_to_association.rb', line 42

def selected_id
  bindings[:object].send(foreign_key)
end