Module: ActiveAdmin::Resource::Naming

Included in:
Page, 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



24
25
26
# File 'lib/active_admin/resource/naming.rb', line 24

def camelized_resource_name
  resource_name.titleize.gsub(' ', '')
end

#plural_camelized_resource_nameObject



28
29
30
# File 'lib/active_admin/resource/naming.rb', line 28

def plural_camelized_resource_name
  plural_resource_name.titleize.gsub(' ', '')
end

#plural_resource_nameObject

Returns the plural version of this resource such as “Bank Accounts”



12
13
14
15
16
# File 'lib/active_admin/resource/naming.rb', line 12

def plural_resource_name
  @plural_resource_name ||= @options[:as].pluralize if @options[:as]
  @plural_resource_name ||= plural_human_name
  @plural_resource_name ||= resource_name.pluralize
end

#plural_underscored_resource_nameObject

Returns the plural and underscored version of this resource. Useful for element id’s.



38
39
40
# File 'lib/active_admin/resource/naming.rb', line 38

def plural_underscored_resource_name
  plural_camelized_resource_name.underscore
end

#resource_keyObject

A name used internally to uniquely identify this resource



19
20
21
# File 'lib/active_admin/resource/naming.rb', line 19

def resource_key
  camelized_resource_name
end

#resource_nameObject

Returns the name to call this resource such as “Bank Account”



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

def resource_name
  @resource_name ||= @options[:as]
  @resource_name ||= singular_human_name
  @resource_name ||= resource_class.name.gsub('::',' ')
end

#underscored_resource_nameObject

An underscored safe representation internally for this resource



33
34
35
# File 'lib/active_admin/resource/naming.rb', line 33

def underscored_resource_name
  camelized_resource_name.underscore
end