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.
@@ -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 = ActiveSupport::Inflector.demodulize(klass.name)
27
- class_name = ActiveSupport::Inflector.underscore(class_name)
28
- class_name = class_name[0, class_name.length - CONTROLLER_SUFFIX.length] if class_name_options[:strip_controller_suffix] && class_name.end_with?(CONTROLLER_SUFFIX)
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
@@ -1,3 +1,3 @@
1
1
  module I18nScopes
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_scopes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: