Sha256: 125e43ab307074f537790f3268448ca1b65290c580a693e7bbe0e70bb38db785

Contents?: true

Size: 618 Bytes

Versions: 4

Compression:

Stored size: 618 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

          private

          def renderer_options
            resource_record = reflection.klass.include? Plutonium::Reactor::ResourceRecord
            {
              helper: resource_record ? :display_association_value : :display_name_of
            }
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plutonium-0.6.2 lib/plutonium/core/fields/renderers/association_renderer.rb
plutonium-0.6.1 lib/plutonium/core/fields/renderers/association_renderer.rb
plutonium-0.6.0 lib/plutonium/core/fields/renderers/association_renderer.rb
plutonium-0.5.0 lib/plutonium/core/fields/renderers/association_renderer.rb