Sha256: 40c1100022e5cfc0d7f1714381ec1e245b1d07bf1ead723f6161cf6e87e39b52

Contents?: true

Size: 490 Bytes

Versions: 26

Compression:

Stored size: 490 Bytes

Contents

module HydraEditor
  class FieldMetadataService
    # If the field is a reflection, delegate to the reflection.
    # If the field is a property, delegate to the property.
    # Otherwise return false
    def self.multiple?(model_class, field)
      if reflection = model_class.reflect_on_association(field)
        reflection.collection?
      elsif model_class.attribute_names.include?(field.to_s)
        model_class.multiple?(field)
      else
        false
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
hydra-editor-6.3.0 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-6.2.0 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-6.1.0 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-6.0.0 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-5.0.5 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-5.0.4 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-5.0.3 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-5.0.2 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-5.0.1 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-5.0.0 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-4.0.2 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-4.0.1 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-3.4.0 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-3.4.0.beta app/services/hydra_editor/field_metadata_service.rb
hydra-editor-3.3.2 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-3.3.1 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-3.2.1 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-3.2.0 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-3.1.2 app/services/hydra_editor/field_metadata_service.rb
hydra-editor-3.1.1 app/services/hydra_editor/field_metadata_service.rb