Module: ActiveAdmin::Resource::Naming

Included in:
ActiveAdmin::Resource
Defined in:
lib/active_admin/resource/naming.rb

Instance Method Summary collapse

Instance Method Details

#camelized_resource_nameObject

A camelized safe representation for this resource



15
16
17
# File 'lib/active_admin/resource/naming.rb', line 15

def camelized_resource_name
  underscored_resource_name.camelize
end

#plural_resource_nameObject

Returns the plural version of this resource



30
31
32
# File 'lib/active_admin/resource/naming.rb', line 30

def plural_resource_name
  @plural_resource_name ||= resource_name.pluralize
end

#resource_nameObject

Returns the name to call this resource. By default will use resource.model_name.human



21
22
23
24
25
26
27
# File 'lib/active_admin/resource/naming.rb', line 21

def resource_name
  @resource_name ||= if @options[:as] || !resource.respond_to?(:model_name)
    underscored_resource_name.titleize
  else
    resource.model_name.human.titleize
  end
end

#underscored_resource_nameObject

An underscored safe representation internally for this resource



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

def underscored_resource_name
  @underscored_resource_name ||= if @options[:as]
    @options[:as].gsub(' ', '').underscore.singularize
  else
    resource.name.gsub('::','').underscore
  end
end