Sha256: 340325ef25ece0536ab6c4ad2491b3ed45556845959d6b2a1a7632ea533474bb

Contents?: true

Size: 468 Bytes

Versions: 4

Compression:

Stored size: 468 Bytes

Contents

# frozen_string_literal: true

module LinkedRails
  class Form
    class Field
      class AssociationInput < Field
        attr_writer :nested_form

        def datatype; end

        def nested_form
          @nested_form ||= klass_name.constantize.form_class
        end

        private

        def klass_name
          @klass_name ||= form.model_class.try(:reflections).try(:[], key.to_s)&.class_name || key.to_s.classify
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
linked_rails-0.0.4 app/models/linked_rails/form/field/association_input.rb
linked_rails-0.0.3 app/models/linked_rails/form/field/association_input.rb
linked_rails-0.0.2 app/models/linked_rails/form/field/association_input.rb
linked_rails-0.0.1 app/models/linked_rails/form/field/association_input.rb