Module: Hyrax::Naming::ClassMethods

Defined in:
app/models/concerns/hyrax/naming.rb

Instance Method Summary collapse

Instance Method Details

#model_name(name_class: _hyrax_default_name_class) ⇒ Object

Override of ActiveModel::Model name that allows us to use our custom name class



11
12
13
14
15
16
17
18
# File 'app/models/concerns/hyrax/naming.rb', line 11

def model_name(name_class: _hyrax_default_name_class)
  @_model_name ||= begin
    namespace = module_parents.detect do |n|
      n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
    end
    name_class.new(self, namespace)
  end
end