Class: RailsAdmin::Config::Fields::Association
- Defined in:
- lib/rails_admin/config/fields/association.rb
Direct Known Subclasses
Types::BelongsToAssociation, Types::HasManyAssociation, Types::HasOneAssociation
Instance Attribute Summary
Attributes inherited from Base
#abstract_model, #defined, #name, #order, #parent, #properties, #root, #section
Attributes included from Proxyable
Class Method Summary collapse
Instance Method Summary collapse
-
#associated_model_config ⇒ Object
Reader for the association’s child model’s configuration.
-
#associated_object_label_method ⇒ Object
Reader for the association’s child model object’s label method.
-
#associated_primary_key ⇒ Object
Reader for associated primary key.
-
#association ⇒ Object
Reader for the association information hash.
-
#foreign_key ⇒ Object
Reader for the association’s key.
-
#multiple? ⇒ Boolean
has many?.
-
#polymorphic? ⇒ Boolean
Reader whether this is a polymorphic association.
-
#value ⇒ Object
Reader for the association’s value unformatted.
- #virtual? ⇒ Boolean
Methods inherited from Base
#association?, #editable?, #errors, #html_default_value, #initialize, #inspect, #inverse_of, #method_name, #optional, #optional=, #optional?, #parse_input, #type, #type_css_class
Methods included from Groupable
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
Constructor Details
This class inherits a constructor from RailsAdmin::Config::Fields::Base
Class Method Details
.inherited(klass) ⇒ Object
9 10 11 |
# File 'lib/rails_admin/config/fields/association.rb', line 9 def self.inherited(klass) super(klass) end |
Instance Method Details
#associated_model_config ⇒ Object
Reader for the association’s child model’s configuration
62 63 64 |
# File 'lib/rails_admin/config/fields/association.rb', line 62 def associated_model_config @associated_model_config ||= RailsAdmin.config(association[:model_proc].call) end |
#associated_object_label_method ⇒ Object
Reader for the association’s child model object’s label method
67 68 69 |
# File 'lib/rails_admin/config/fields/association.rb', line 67 def associated_object_label_method @associated_object_label_method ||= associated_model_config.object_label_method end |
#associated_primary_key ⇒ Object
Reader for associated primary key
72 73 74 |
# File 'lib/rails_admin/config/fields/association.rb', line 72 def associated_primary_key @associated_primary_key ||= association[:primary_key_proc].call end |
#association ⇒ Object
Reader for the association information hash
14 15 16 |
# File 'lib/rails_admin/config/fields/association.rb', line 14 def association @properties end |
#foreign_key ⇒ Object
Reader for the association’s key
77 78 79 |
# File 'lib/rails_admin/config/fields/association.rb', line 77 def foreign_key association[:foreign_key] end |
#multiple? ⇒ Boolean
has many?
97 98 99 |
# File 'lib/rails_admin/config/fields/association.rb', line 97 def multiple? true end |
#polymorphic? ⇒ Boolean
Reader whether this is a polymorphic association
82 83 84 |
# File 'lib/rails_admin/config/fields/association.rb', line 82 def polymorphic? association[:polymorphic] end |
#value ⇒ Object
Reader for the association’s value unformatted
92 93 94 |
# File 'lib/rails_admin/config/fields/association.rb', line 92 def value bindings[:object].safe_send(association[:name]) end |
#virtual? ⇒ Boolean
101 102 103 |
# File 'lib/rails_admin/config/fields/association.rb', line 101 def virtual? true end |