Class: Madmin::Fields::Polymorphic
- Inherits:
-
Madmin::Field
- Object
- Madmin::Field
- Madmin::Fields::Polymorphic
- Defined in:
- lib/madmin/fields/polymorphic.rb
Instance Attribute Summary
Attributes inherited from Madmin::Field
#attribute_name, #model, #options, #resource
Instance Method Summary collapse
Methods inherited from Madmin::Field
#default_index_attributes, field_type, #initialize, #required?, #searchable?, #to_partial_path, #value, #visible?
Constructor Details
This class inherits a constructor from Madmin::Field
Instance Method Details
#options_for_select(record) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/madmin/fields/polymorphic.rb', line 4 def (record) if (collection = [:collection]) collection.call else [value(record)].compact end end |
#to_param ⇒ Object
12 13 14 |
# File 'lib/madmin/fields/polymorphic.rb', line 12 def to_param {attribute_name => %i[type value]} end |