Module: ObjectAttorney::Naming

Included in:
ClassMethods
Defined in:
lib/object_attorney/naming.rb

Instance Method Summary collapse

Instance Method Details

#model_nameObject



5
6
7
8
9
10
11
12
# File 'lib/object_attorney/naming.rb', line 5

def model_name
  @_model_name ||= begin
    namespace = self.parents.detect do |n|
      n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
    end
    ActiveModel::Name.new(represented_object_class || self, namespace)
  end
end