i18n_scopes 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/i18n_scopes/translation_utils.rb +7 -4
- data/lib/i18n_scopes/version.rb +1 -1
- metadata +1 -1
@@ -23,9 +23,12 @@ module I18nScopes
|
|
23
23
|
# * +options+: options like plural_class and strip_controller_suffix
|
24
24
|
def self.class_name(klass, options = {})
|
25
25
|
class_name_options = options.merge(options)
|
26
|
-
class_name =
|
27
|
-
|
28
|
-
|
26
|
+
class_name = if class_name_options[:strip_controller_suffix] && klass.respond_to?(:controller_name)
|
27
|
+
klass.controller_name
|
28
|
+
else
|
29
|
+
demodulized = ActiveSupport::Inflector.demodulize(klass.name)
|
30
|
+
ActiveSupport::Inflector.underscore(demodulized)
|
31
|
+
end
|
29
32
|
if class_name_options[:plural_class]
|
30
33
|
ActiveSupport::Inflector.pluralize(class_name)
|
31
34
|
else
|
@@ -49,7 +52,7 @@ module I18nScopes
|
|
49
52
|
end
|
50
53
|
raise "Failed to get method_name"
|
51
54
|
end
|
52
|
-
|
55
|
+
|
53
56
|
end
|
54
57
|
|
55
58
|
end
|
data/lib/i18n_scopes/version.rb
CHANGED