activemodel 3.1.0.rc2 → 3.1.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/active_model/naming.rb +4 -3
- data/lib/active_model/translation.rb +3 -2
- data/lib/active_model/version.rb +1 -1
- metadata +7 -7
data/lib/active_model/naming.rb
CHANGED
@@ -21,7 +21,7 @@ module ActiveModel
|
|
21
21
|
@partial_path = "#{@collection}/#{@element}".freeze
|
22
22
|
@param_key = (namespace ? _singularize(@unnamespaced) : @singular).freeze
|
23
23
|
@route_key = (namespace ? ActiveSupport::Inflector.pluralize(@param_key) : @plural).freeze
|
24
|
-
@i18n_key = self.underscore.to_sym
|
24
|
+
@i18n_key = self.underscore.tr('/', '.').to_sym
|
25
25
|
end
|
26
26
|
|
27
27
|
# Transform the model name into a more humane format, using I18n. By default,
|
@@ -35,8 +35,9 @@ module ActiveModel
|
|
35
35
|
@klass.respond_to?(:i18n_scope)
|
36
36
|
|
37
37
|
defaults = @klass.lookup_ancestors.map do |klass|
|
38
|
-
klass.model_name.i18n_key
|
39
|
-
|
38
|
+
[klass.model_name.i18n_key,
|
39
|
+
klass.model_name.i18n_key.to_s.tr('.', '/').to_sym]
|
40
|
+
end.flatten
|
40
41
|
|
41
42
|
defaults << options[:default] if options[:default]
|
42
43
|
defaults << @human
|
@@ -44,8 +44,9 @@ module ActiveModel
|
|
44
44
|
# Specify +options+ with additional translating options.
|
45
45
|
def human_attribute_name(attribute, options = {})
|
46
46
|
defaults = lookup_ancestors.map do |klass|
|
47
|
-
:"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}"
|
48
|
-
|
47
|
+
[:"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}",
|
48
|
+
:"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key.to_s.tr('.', '/')}.#{attribute}"]
|
49
|
+
end.flatten
|
49
50
|
|
50
51
|
defaults << :"attributes.#{attribute}"
|
51
52
|
defaults << options.delete(:default) if options[:default]
|
data/lib/active_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424099
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 1
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 3.1.0.
|
11
|
+
- 3
|
12
|
+
version: 3.1.0.rc3
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- David Heinemeier Hansson
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-06-
|
20
|
+
date: 2011-06-08 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: activesupport
|
@@ -27,14 +27,14 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - "="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 15424099
|
31
31
|
segments:
|
32
32
|
- 3
|
33
33
|
- 1
|
34
34
|
- 0
|
35
35
|
- rc
|
36
|
-
-
|
37
|
-
version: 3.1.0.
|
36
|
+
- 3
|
37
|
+
version: 3.1.0.rc3
|
38
38
|
type: :runtime
|
39
39
|
version_requirements: *id001
|
40
40
|
- !ruby/object:Gem::Dependency
|