Sha256: 912055fcf25f3822a0a47739d81cc3882938b01d4b75c75d55cd1e8aa5ccab85
Contents?: true
Size: 649 Bytes
Versions: 13
Compression:
Stored size: 649 Bytes
Contents
module Plutonium module Core module Fields module Renderers class AssociationRenderer < BasicRenderer attr_reader :reflection def initialize(name, reflection:, **user_options) @reflection = reflection super(name, **user_options) end def render(view_context, record) value = record.send(name) options = self.options.merge(helper: value.class.include?(Plutonium::Resource::Record) ? :display_association_value : :display_name_of) view_context.display_field value:, **options end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems