smooth_operator 1.22.3 → 1.22.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/smooth_operator/resource_name.rb +11 -7
- data/lib/smooth_operator/version.rb +1 -1
- data/lib/smooth_operator.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzM5Mjk2ZmFjNmJhMDgzOWVhMTgyOTJkYTk0ZDBkMjgxZjVjNmUwOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWEzODFiMzhkNTM5OTFiMDExOTJjMjE2ZThkMmQ3NjUyODhmZDMxZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Nzk1ZmRhYzJkZjEyZGRkMDg5ZTE0ZGNjMDk3ODk0ZWMyNDYzZmJhMTkyMTdj
|
10
|
+
Mzc1OGMyMDkxZWE2OTcyYjExMWYwODUzMTMxMmFjOGY1NDZmYTA0MGRlMGQx
|
11
|
+
ZWE4ZmJiZTgzNzk4Njc1ZWZlNTJhNTgxMDk0NzhjY2NkMTc0Yzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjhiMGMzMGIxYjY0NWZjOTkxZjA4ZGU5Yjk2MzExMjU2ODA4M2YxNjk2YWY5
|
14
|
+
OWYxYjMwZjRlN2NjNTJmYzI5ZGYwODE1NGUxZjVhODQ5YTQ3MWMxZjRiYjcz
|
15
|
+
ZGIxMzkwMTUzMzgxMmU2NDBjNTRmMzNhYmFlMDMxMTZiZGY3ODM=
|
@@ -18,28 +18,32 @@ module SmoothOperator
|
|
18
18
|
attr_writer :resource_name
|
19
19
|
|
20
20
|
def model_name
|
21
|
-
return '' if
|
21
|
+
return '' if custom_model_name == :none
|
22
22
|
|
23
23
|
if defined? ActiveModel
|
24
|
-
|
24
|
+
smooth_model_name
|
25
25
|
else
|
26
|
-
|
26
|
+
custom_model_name ||= name.split('::').last.underscore.capitalize
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
def model_name=(name)
|
31
|
-
@
|
31
|
+
@custom_model_name = name
|
32
|
+
end
|
33
|
+
|
34
|
+
def custom_model_name
|
35
|
+
Helpers.get_instance_variable(self, :custom_model_name, nil)
|
32
36
|
end
|
33
37
|
|
34
38
|
protected ############## PROTECTED #############
|
35
39
|
|
36
|
-
def
|
37
|
-
@
|
40
|
+
def smooth_model_name
|
41
|
+
@_model_name ||= begin
|
38
42
|
namespace ||= self.parents.detect do |n|
|
39
43
|
n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
|
40
44
|
end
|
41
45
|
|
42
|
-
ActiveModel::Name.new(self, namespace,
|
46
|
+
ActiveModel::Name.new(self, namespace, custom_model_name).tap do |model_name|
|
43
47
|
def model_name.human(options = {}); SmoothOperator::Translation::HelperMethods.translate("models.#{i18n_key}", options); end
|
44
48
|
end
|
45
49
|
end
|
data/lib/smooth_operator.rb
CHANGED