i18n_scopes 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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