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
#defined, #name, #order, #properties
Attributes inherited from Base
#abstract_model, #bindings, #parent, #root
Class Method Summary collapse
Instance Method Summary collapse
-
#associated_label_method ⇒ Object
Reader for the association’s child model object’s label method.
-
#associated_model_config ⇒ Object
Reader for the association’s child model’s configuration.
-
#association ⇒ Object
Reader for the association information hash.
-
#child_key ⇒ Object
Reader for the association’s child key.
-
#errors ⇒ Object
Reader for validation errors of the bound object.
-
#inverse_of ⇒ Object
Reader for the inverse relationship.
-
#polymorphic? ⇒ Boolean
Reader whether this is a polymorphic association.
-
#value ⇒ Object
Reader for the association’s value unformatted.
Methods inherited from Base
#association?, #column_css_class, #dom_id, #dom_name, #has_errors?, #initialize, #method_name, #optional, #optional=, #optional?, #type, #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
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_label_method ⇒ Object
Reader for the association’s child model object’s label method
70 71 72 |
# File 'lib/rails_admin/config/fields/association.rb', line 70 def associated_label_method @associated_label_method ||= associated_model_config.object_label_method end |
#associated_model_config ⇒ Object
Reader for the association’s child model’s configuration
65 66 67 |
# File 'lib/rails_admin/config/fields/association.rb', line 65 def associated_model_config @associated_model_config ||= RailsAdmin.config(association[:child_model]) 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 |
#child_key ⇒ Object
Reader for the association’s child key
75 76 77 |
# File 'lib/rails_admin/config/fields/association.rb', line 75 def child_key association[:child_key] end |
#errors ⇒ Object
Reader for validation errors of the bound object
85 86 87 |
# File 'lib/rails_admin/config/fields/association.rb', line 85 def errors bindings[:object].errors[child_key] end |
#inverse_of ⇒ Object
Reader for the inverse relationship
80 81 82 |
# File 'lib/rails_admin/config/fields/association.rb', line 80 def inverse_of association[:inverse_of] end |
#polymorphic? ⇒ Boolean
Reader whether this is a polymorphic association
90 91 92 |
# File 'lib/rails_admin/config/fields/association.rb', line 90 def polymorphic? association[:polymorphic] end |
#value ⇒ Object
Reader for the association’s value unformatted
95 96 97 |
# File 'lib/rails_admin/config/fields/association.rb', line 95 def value bindings[:object].send(association[:name]) end |