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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDUyOWVhNTJiZTBhZGEwODhkZjhhY2RiMDAzZDFmMmFlODU2NjBmMA==
4
+ NzM5Mjk2ZmFjNmJhMDgzOWVhMTgyOTJkYTk0ZDBkMjgxZjVjNmUwOQ==
5
5
  data.tar.gz: !binary |-
6
- MGMzMjdiMDU1ODY1MGU1MmRiYjhjZjM1ZGNiNjRiYjg3YmEwNTIzYw==
6
+ OWEzODFiMzhkNTM5OTFiMDExOTJjMjE2ZThkMmQ3NjUyODhmZDMxZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzU1YWQyYTQwOTExMGMzZmU2YWJkZGY3ZTc0N2VmNThhMWE1ZjgzNDI5ZDVi
10
- OTIwZGFmOGMyZmViZTdkODliY2Y3ZmU0YzdiMjBkNTFkYmQwNjg2MzhhMjBk
11
- MDkxYjM0NzFhOTM5YTliOTMxZmE4N2UwZmJkZGRiMTYyODAzN2E=
9
+ Nzk1ZmRhYzJkZjEyZGRkMDg5ZTE0ZGNjMDk3ODk0ZWMyNDYzZmJhMTkyMTdj
10
+ Mzc1OGMyMDkxZWE2OTcyYjExMWYwODUzMTMxMmFjOGY1NDZmYTA0MGRlMGQx
11
+ ZWE4ZmJiZTgzNzk4Njc1ZWZlNTJhNTgxMDk0NzhjY2NkMTc0Yzc=
12
12
  data.tar.gz: !binary |-
13
- NjczZjVlNzEwZWQ2YTUwYWZjZmI1ZTNhNjJmOTVjMjU1ZmM5YjkyNzY0NWJi
14
- MzNlZjFlNTk1ZGYzZmI5MTAxMGUwNWZkMjFhMjNlNTM5ZTFkOTAwN2M2NGY4
15
- NzZlZjk1YjA4MzVlMmFhZjAxMjJiMTQxOTUxZmNhYTY4NTI0ODM=
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 @_model_name == :none
21
+ return '' if custom_model_name == :none
22
22
 
23
23
  if defined? ActiveModel
24
- rails_model_name_method
24
+ smooth_model_name
25
25
  else
26
- @_model_name ||= name.split('::').last.underscore.capitalize
26
+ custom_model_name ||= name.split('::').last.underscore.capitalize
27
27
  end
28
28
  end
29
29
 
30
30
  def model_name=(name)
31
- @_model_name = name
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 rails_model_name_method
37
- @model_name ||= begin
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, @_model_name).tap do |model_name|
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
@@ -1,3 +1,3 @@
1
1
  module SmoothOperator
2
- VERSION = "1.22.3"
2
+ VERSION = "1.22.4"
3
3
  end
@@ -66,6 +66,10 @@ module SmoothOperator
66
66
 
67
67
  def after_save; end
68
68
 
69
+ def self.model_name
70
+ smooth_model_name
71
+ end
72
+
69
73
  protected ################# PROTECTED ###################
70
74
 
71
75
  def validate_induced_errors
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smooth_operator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.22.3
4
+ version: 1.22.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Gonçalves