Module: Hydra::Presenter::ClassMethods

Defined in:
app/presenters/hydra/presenter.rb

Instance Method Summary collapse

Instance Method Details

#multiple?(field) ⇒ Boolean

Deprecated.

Because if we use an instance method, there will be no need to set self.model_class in most instances. Note, there is a class method multiple? on the form.

Returns:

  • (Boolean)


60
61
62
63
# File 'app/presenters/hydra/presenter.rb', line 60

def multiple?(field)
  Deprecation.warn(ClassMethods, 'The class method multiple? has been deprecated. Use the instance method instead. This will be removed in version 2.0')
  .multiple?(model_class, field)
end

#termsObject



79
80
81
# File 'app/presenters/hydra/presenter.rb', line 79

def terms
  _terms
end

#terms=(terms) ⇒ Object



74
75
76
77
# File 'app/presenters/hydra/presenter.rb', line 74

def terms=(terms)
  self._terms = terms
  create_term_accessors(terms)
end

#unique?(field) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
69
70
71
72
# File 'app/presenters/hydra/presenter.rb', line 65

def unique?(field)
  Deprecation.warn(ClassMethods, "The class method unique? has been deprecated. Use the instance method 'multiple?' instead. This will be removed in version 2.0")
  if reflection = model_class.reflect_on_association(field)
    !reflection.collection?
  else
    model_class.unique?(field)
  end
end