wallaby-core 0.2.11 → 0.3.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/wallaby/resources_controller.rb +20 -7
  3. data/app/security/ability.rb +1 -1
  4. data/config/routes.rb +21 -14
  5. data/lib/adaptors/wallaby/custom/default_provider.rb +1 -1
  6. data/lib/adaptors/wallaby/custom/model_decorator.rb +5 -17
  7. data/lib/adaptors/wallaby/custom/model_finder.rb +3 -3
  8. data/lib/adaptors/wallaby/custom/model_pagination_provider.rb +1 -1
  9. data/lib/adaptors/wallaby/custom/model_service_provider.rb +1 -1
  10. data/lib/authorizers/wallaby/cancancan_authorization_provider.rb +12 -5
  11. data/lib/authorizers/wallaby/default_authorization_provider.rb +10 -1
  12. data/lib/authorizers/wallaby/model_authorizer.rb +41 -16
  13. data/lib/authorizers/wallaby/pundit_authorization_provider.rb +22 -8
  14. data/lib/concerns/wallaby/application_concern.rb +41 -71
  15. data/lib/concerns/wallaby/authentication_concern.rb +29 -127
  16. data/lib/concerns/wallaby/authorizable.rb +14 -57
  17. data/lib/concerns/wallaby/baseable.rb +24 -57
  18. data/lib/concerns/wallaby/configurable.rb +416 -0
  19. data/lib/concerns/wallaby/decoratable.rb +24 -60
  20. data/lib/concerns/wallaby/engineable.rb +29 -46
  21. data/lib/concerns/wallaby/fieldable.rb +45 -56
  22. data/lib/concerns/wallaby/paginatable.rb +20 -51
  23. data/lib/concerns/wallaby/prefixable.rb +24 -4
  24. data/lib/concerns/wallaby/resourcable.rb +130 -72
  25. data/lib/concerns/wallaby/resources_concern.rb +205 -305
  26. data/lib/concerns/wallaby/servicable.rb +8 -48
  27. data/lib/concerns/wallaby/urlable.rb +69 -0
  28. data/lib/decorators/wallaby/resource_decorator.rb +72 -34
  29. data/lib/errors/wallaby/class_not_found.rb +1 -2
  30. data/lib/errors/wallaby/forbidden.rb +1 -2
  31. data/lib/errors/wallaby/general_error.rb +1 -1
  32. data/lib/errors/wallaby/invalid_error.rb +1 -2
  33. data/lib/errors/wallaby/method_removed.rb +5 -0
  34. data/lib/errors/wallaby/model_not_found.rb +1 -2
  35. data/lib/errors/wallaby/not_authenticated.rb +1 -2
  36. data/lib/errors/wallaby/not_found.rb +1 -2
  37. data/lib/errors/wallaby/not_implemented.rb +1 -2
  38. data/lib/errors/wallaby/resource_not_found.rb +1 -2
  39. data/lib/errors/wallaby/unprocessable_entity.rb +1 -2
  40. data/lib/fields/wallaby/all_fields.rb +63 -0
  41. data/lib/forms/wallaby/form_builder.rb +2 -2
  42. data/lib/generators/wallaby/engine/application_generator.rb +33 -0
  43. data/lib/generators/wallaby/engine/authorizer/USAGE +20 -0
  44. data/lib/generators/wallaby/engine/authorizer/authorizer_generator.rb +19 -0
  45. data/lib/generators/wallaby/engine/authorizer/templates/authorizer.rb.erb +35 -0
  46. data/lib/generators/wallaby/engine/controller/USAGE +20 -0
  47. data/lib/generators/wallaby/engine/controller/controller_generator.rb +23 -0
  48. data/lib/generators/wallaby/engine/controller/templates/controller.rb.erb +130 -0
  49. data/lib/generators/wallaby/engine/decorator/USAGE +20 -0
  50. data/lib/generators/wallaby/engine/decorator/decorator_generator.rb +19 -0
  51. data/lib/generators/wallaby/engine/decorator/templates/decorator.rb.erb +5 -0
  52. data/lib/generators/wallaby/engine/install/USAGE +19 -0
  53. data/lib/generators/wallaby/engine/install/install_generator.rb +91 -0
  54. data/lib/generators/wallaby/engine/install/templates/application_authorizer.rb.erb +37 -0
  55. data/lib/generators/wallaby/engine/install/templates/application_controller.rb.erb +173 -0
  56. data/lib/generators/wallaby/engine/install/templates/application_decorator.rb.erb +7 -0
  57. data/lib/generators/wallaby/engine/install/templates/application_paginator.rb.erb +27 -0
  58. data/lib/generators/wallaby/engine/install/templates/application_servicer.rb.erb +47 -0
  59. data/lib/generators/wallaby/engine/install/templates/initializer.rb.erb +16 -0
  60. data/lib/generators/wallaby/engine/paginator/USAGE +20 -0
  61. data/lib/generators/wallaby/engine/paginator/paginator_generator.rb +19 -0
  62. data/lib/generators/wallaby/engine/paginator/templates/paginator.rb.erb +25 -0
  63. data/lib/generators/wallaby/engine/servicer/USAGE +20 -0
  64. data/lib/generators/wallaby/engine/servicer/servicer_generator.rb +19 -0
  65. data/lib/generators/wallaby/engine/servicer/templates/servicer.rb.erb +45 -0
  66. data/lib/helpers/wallaby/application_helper.rb +10 -59
  67. data/lib/helpers/wallaby/base_helper.rb +11 -11
  68. data/lib/helpers/wallaby/configuration_helper.rb +36 -4
  69. data/lib/helpers/wallaby/form_helper.rb +1 -1
  70. data/lib/helpers/wallaby/index_helper.rb +19 -9
  71. data/lib/helpers/wallaby/links_helper.rb +13 -80
  72. data/lib/helpers/wallaby/resources_helper.rb +39 -7
  73. data/lib/helpers/wallaby/secure_helper.rb +20 -19
  74. data/lib/interfaces/wallaby/mode.rb +8 -8
  75. data/lib/interfaces/wallaby/model_authorization_provider.rb +23 -22
  76. data/lib/interfaces/wallaby/model_decorator.rb +36 -48
  77. data/lib/interfaces/wallaby/model_finder.rb +3 -3
  78. data/lib/interfaces/wallaby/model_pagination_provider.rb +2 -6
  79. data/lib/interfaces/wallaby/model_service_provider.rb +4 -4
  80. data/lib/paginators/wallaby/model_paginator.rb +1 -1
  81. data/lib/responders/wallaby/json_api_responder.rb +10 -5
  82. data/lib/responders/wallaby/resources_responder.rb +7 -2
  83. data/lib/routes/wallaby/engines/base_route.rb +78 -0
  84. data/lib/routes/wallaby/engines/custom_app_route.rb +92 -0
  85. data/lib/routes/wallaby/engines/engine_route.rb +77 -0
  86. data/lib/routes/wallaby/resources_router.rb +100 -45
  87. data/lib/servicers/wallaby/model_servicer.rb +13 -13
  88. data/lib/services/wallaby/authorizer_finder.rb +23 -0
  89. data/lib/services/wallaby/class_finder.rb +42 -0
  90. data/lib/services/wallaby/controller_finder.rb +29 -0
  91. data/lib/services/wallaby/decorator_finder.rb +34 -0
  92. data/lib/services/wallaby/default_models_excluder.rb +45 -0
  93. data/lib/services/wallaby/engine_name_finder.rb +14 -11
  94. data/lib/services/wallaby/engine_url_for.rb +82 -37
  95. data/lib/services/wallaby/fields_regulator.rb +34 -0
  96. data/lib/services/wallaby/map/mode_mapper.rb +4 -4
  97. data/lib/services/wallaby/map/model_class_mapper.rb +1 -1
  98. data/lib/services/wallaby/model_class_filter.rb +29 -0
  99. data/lib/services/wallaby/paginator_finder.rb +24 -0
  100. data/lib/services/wallaby/prefixes_builder.rb +49 -8
  101. data/lib/services/wallaby/servicer_finder.rb +31 -0
  102. data/lib/services/wallaby/sorting/hash_builder.rb +9 -0
  103. data/lib/services/wallaby/sorting/link_builder.rb +7 -10
  104. data/lib/services/wallaby/sorting/next_builder.rb +1 -12
  105. data/lib/services/wallaby/sorting/single_builder.rb +1 -1
  106. data/lib/support/action_dispatch/routing/mapper.rb +29 -4
  107. data/lib/utils/wallaby/field_utils.rb +9 -8
  108. data/lib/utils/wallaby/inflector.rb +94 -0
  109. data/lib/utils/wallaby/locale.rb +2 -2
  110. data/lib/utils/wallaby/module_utils.rb +3 -10
  111. data/lib/utils/wallaby/utils.rb +21 -14
  112. data/lib/wallaby/class_array.rb +18 -13
  113. data/lib/wallaby/class_hash.rb +16 -14
  114. data/lib/wallaby/classifier.rb +4 -2
  115. data/lib/wallaby/configuration/features.rb +8 -2
  116. data/lib/wallaby/configuration/mapping.rb +66 -112
  117. data/lib/wallaby/configuration/metadata.rb +15 -12
  118. data/lib/wallaby/configuration/models.rb +27 -25
  119. data/lib/wallaby/configuration/pagination.rb +15 -19
  120. data/lib/wallaby/configuration/security.rb +88 -80
  121. data/lib/wallaby/configuration/sorting.rb +15 -17
  122. data/lib/wallaby/configuration.rb +58 -23
  123. data/lib/wallaby/constants.rb +21 -13
  124. data/lib/wallaby/core/version.rb +1 -1
  125. data/lib/wallaby/core.rb +34 -10
  126. data/lib/wallaby/deprecator.rb +81 -0
  127. data/lib/wallaby/engine.rb +2 -19
  128. data/lib/wallaby/guesser.rb +45 -0
  129. data/lib/wallaby/logger.rb +35 -13
  130. data/lib/wallaby/map.rb +11 -88
  131. data/lib/wallaby/preloader.rb +9 -31
  132. metadata +120 -15
  133. data/config/locales/wallaby_class.en.yml +0 -9
  134. data/lib/concerns/wallaby/defaultable.rb +0 -38
  135. data/lib/concerns/wallaby/shared_helpers.rb +0 -22
  136. data/lib/services/wallaby/map/model_class_collector.rb +0 -49
  137. data/lib/services/wallaby/type_renderer.rb +0 -40
  138. data/lib/utils/wallaby/model_utils.rb +0 -52
  139. data/lib/utils/wallaby/test_utils.rb +0 -34
@@ -5,72 +5,34 @@ module Wallaby
5
5
  module AuthenticationConcern
6
6
  extend ActiveSupport::Concern
7
7
 
8
- # @deprecated Use {#wallaby_user} instead
9
- # @!method current_user
10
- # @note This is a template method that can be overridden by subclasses
11
- # This {current_user} method will try to looking up the actual implementation from the following
12
- # places from high precedence to low:
13
- #
14
- # - {Wallaby::Configuration::Security#current_user}
15
- # - `super`
16
- # - do nothing
17
- #
18
- # It can be replaced completely in subclasses:
19
- #
20
- # def current_user
21
- # # NOTE: please ensure `@current_user` is assigned, for instance:
22
- # @current_user ||= User.new params.slice(:email)
23
- # end
24
- # @return [Object] a user object
8
+ included do
9
+ try :helper_method, :wallaby_user
25
10
 
26
- # @deprecated Use {#authenticate_wallaby_user!} instead
27
- # @!method authenticate_user!
28
- # @note This is a template method that can be overridden by subclasses
29
- # This {authenticate_user!} method will try to looking up the actual implementation from the following
30
- # places from high precedence to low:
31
- #
32
- # - {Wallaby::Configuration::Security#authenticate}
33
- # - `super`
34
- # - do nothing
35
- #
36
- # It can be replaced completely in subclasses:
37
- #
38
- # def authenticate_user!
39
- # authenticate_or_request_with_http_basic do |username, password|
40
- # username == 'too_simple' && password == 'too_naive'
41
- # end
42
- # end
43
- # @return [true] when user is authenticated successfully
44
- # @raise [Wallaby::NotAuthenticated] when user fails to authenticate
11
+ rescue_from NotAuthenticated, with: :unauthorized
12
+ rescue_from Forbidden, with: :forbidden
13
+
14
+ # # @note This is a proxy method to ensure {#current_user} exists
15
+ unless method_defined?(:current_user)
16
+ def current_user
17
+ defined?(super) ? super : nil
18
+ end
19
+ end
20
+ end
45
21
 
46
- # @!method wallaby_user
47
22
  # @note This is a template method that can be overridden by subclasses
48
- # This method will try to call {#current_user} from superclass.
23
+ # This method will try to call #current_user from superclass.
49
24
  # @example It can be overridden in subclasses:
50
25
  # def wallaby_user
51
26
  # # NOTE: better to assign user to `@wallaby_user` for better performance:
52
27
  # @wallaby_user ||= User.new params.slice(:email)
53
28
  # end
54
29
  # @return [Object] a user object
30
+ def wallaby_user
31
+ @wallaby_user ||= try :current_user
32
+ end
55
33
 
56
- # @!method pundit_user
57
- # @note This is a template method that can be overridden by subclasses
58
- # This overridden method of {#original_pundit_user} will try to call {#wallaby_user} instead of {#current_user}.
59
- # @example It can be overridden in subclasses:
60
- # def pundit_user
61
- # @pundit_user ||= User.new params.slice(:email)
62
- # end
63
- # @return [Object] a user object
64
-
65
- # @!parse alias :override_pundit_user :pundit_user
66
-
67
- # @!method original_pundit_user
68
- # This method is the original version of {#pundit_user} which calls the {#current_user}.
69
- # @return [Object] a user object
70
-
71
- # @!method authenticate_wallaby_user!
72
34
  # @note This is a template method that can be overridden by subclasses
73
- # This method will try to call {#authenticate_user!} from superclass.
35
+ # This method will try to call #authenticate_user! from superclass.
74
36
  # And it will be run as the first callback before an action.
75
37
  # @example It can be overridden in subclasses:
76
38
  # def authenticate_wallaby_user!
@@ -79,84 +41,24 @@ module Wallaby
79
41
  # end
80
42
  # end
81
43
  # @return [true] when user is authenticated successfully
82
- # @raise [Wallaby::NotAuthenticated] when user fails to authenticate
44
+ # @raise [NotAuthenticated] when user fails to authenticate
45
+ def authenticate_wallaby_user!
46
+ authenticated = try :authenticate_user!
47
+ raise NotAuthenticated if authenticated == false
48
+
49
+ true
50
+ end
83
51
 
84
- # @!method unauthorized(exception = nil)
85
52
  # Unauthorized page.
86
53
  # @param exception [Exception] comes from **rescue_from**
54
+ def unauthorized(exception = nil)
55
+ render_error exception, __callee__
56
+ end
87
57
 
88
- # @!method forbidden(exception = nil)
89
58
  # Forbidden page.
90
59
  # @param exception [Exception] comes from **rescue_from**
91
-
92
- included do # rubocop:disable Metrics/BlockLength
93
- helper_method :wallaby_user
94
-
95
- rescue_from NotAuthenticated, with: :unauthorized
96
- rescue_from Forbidden, with: :forbidden
97
-
98
- # (see #current_user)
99
- # TODO: remove this from 6.2
100
- def current_user
101
- @current_user ||=
102
- if security.current_user? || !defined? super
103
- instance_exec(&security.current_user)
104
- else
105
- Logger.deprecated 'Wallaby will use `wallaby_user` instead of `current_user` from 6.2.'
106
- super
107
- end
108
- end
109
-
110
- # (see #authenticate_user!)
111
- # TODO: remove this from 6.2
112
- def authenticate_user!
113
- authenticated =
114
- if security.authenticate? || !defined? super
115
- instance_exec(&security.authenticate)
116
- else
117
- Logger.deprecated 'Wallaby will use `authenticate_wallaby_user!`' \
118
- 'instead of `authenticate_user!` from 6.2.'
119
- super
120
- end
121
- raise NotAuthenticated if authenticated == false
122
-
123
- true
124
- end
125
-
126
- # (see #wallaby_user)
127
- def wallaby_user
128
- @wallaby_user ||= try :current_user
129
- end
130
-
131
- if defined?(::Pundit) && instance_methods.include?(:pundit_user)
132
- # (see #override_pundit_user)
133
- def override_pundit_user
134
- wallaby_user
135
- end
136
-
137
- # (see #original_pundit_user)
138
- alias_method :original_pundit_user, :pundit_user
139
- # (see #pundit_user)
140
- alias_method :pundit_user, :override_pundit_user
141
- end
142
-
143
- # (see #authenticate_wallaby_user!)
144
- def authenticate_wallaby_user!
145
- authenticated = try :authenticate_user!
146
- raise NotAuthenticated if authenticated == false
147
-
148
- true
149
- end
150
-
151
- # (see #unauthorized)
152
- def unauthorized(exception = nil)
153
- render_error exception, __callee__
154
- end
155
-
156
- # (see #forbidden)
157
- def forbidden(exception = nil)
158
- render_error exception, __callee__
159
- end
60
+ def forbidden(exception = nil)
61
+ render_error exception, __callee__
160
62
  end
161
63
  end
162
64
  end
@@ -1,61 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wallaby
4
- # Authorizer related attributes
4
+ # Authorizer related
5
5
  module Authorizable
6
- # Configurable attribute for authorizer related
7
- module ClassMethods
8
- # @!attribute [w] model_authorizer
9
- def model_authorizer=(model_authorizer)
10
- ModuleUtils.inheritance_check model_authorizer, application_authorizer
11
- @model_authorizer = model_authorizer
12
- end
13
-
14
- # @!attribute [r] model_authorizer
15
- # If Wallaby doesn't get it right, please specify the **model_authorizer**.
16
- # @example To set model authorizer
17
- # class Admin::ProductionsController < Admin::ApplicationController
18
- # self.model_authorizer = ProductAuthorizer
19
- # end
20
- # @return [Class] model authorizer
21
- # @raise [ArgumentError] when **model_authorizer** doesn't inherit from **application_authorizer**
22
- # @see Wallaby::ModelAuthorizer
23
- # @since wallaby-5.2.0
24
- attr_reader :model_authorizer
25
-
26
- # @!attribute [w] application_authorizer
27
- def application_authorizer=(application_authorizer)
28
- ModuleUtils.inheritance_check model_authorizer, application_authorizer
29
- @application_authorizer = application_authorizer
30
- end
31
-
32
- # @!attribute [r] application_authorizer
33
- # The **application_authorizer** is as the base class of {#model_authorizer}.
34
- # @example To set application decorator:
35
- # class Admin::ApplicationController < Wallaby::ResourcesController
36
- # self.application_authorizer = AnotherApplicationAuthorizer
37
- # end
38
- # @return [Class] application decorator
39
- # @raise [ArgumentError] when **model_authorizer** doesn't inherit from **application_authorizer**
40
- # @see Wallaby::ModelAuthorizer
41
- # @since wallaby-5.2.0
42
- def application_authorizer
43
- @application_authorizer ||= ModuleUtils.try_to superclass, :application_authorizer
44
- end
45
- end
46
-
47
6
  # Model authorizer for current modal class.
48
- #
49
- # It can be configured in following class attributes:
50
- #
51
- # - controller configuration {Wallaby::Authorizable::ClassMethods#model_authorizer .model_authorizer}
52
- # - a generic authorizer based on
53
- # {Wallaby::Authorizable::ClassMethods#application_authorizer .application_authorizer}
54
- # @return [Wallaby::ModelAuthorizer] model authorizer
7
+ # @return [ModelAuthorizer] model authorizer
8
+ # @see #authorizer_of
55
9
  # @since wallaby-5.2.0
56
10
  def current_authorizer
57
11
  @current_authorizer ||=
58
- authorizer_of(current_model_class, controller_to_get(:model_authorizer)).tap do |authorizer|
12
+ authorizer_of(current_model_class).tap do |authorizer|
59
13
  Logger.debug %(Current authorizer: #{authorizer.try(:class)}), sourcing: false
60
14
  end
61
15
  end
@@ -70,7 +24,7 @@ module Wallaby
70
24
  return false unless subject
71
25
 
72
26
  klass = subject.is_a?(Class) ? subject : subject.class
73
- authorizer_of(klass).authorized? action, subject
27
+ authorizer_of(klass).authorized?(action, subject)
74
28
  end
75
29
 
76
30
  # Check if user is allowed to perform action on given subject
@@ -80,18 +34,21 @@ module Wallaby
80
34
  # @return [false] if allowed
81
35
  # @since wallaby-5.2.0
82
36
  def unauthorized?(action, subject)
83
- !authorized? action, subject
37
+ !authorized?(action, subject)
84
38
  end
85
39
 
86
40
  protected
87
41
 
88
42
  # @param model_class [Class]
89
- # @param authorizer_class [Class, nil]
90
- # @return [Wallaby::ModelAuthorizer] model authorizer for given model
43
+ # @return [ModelAuthorizer] model authorizer for given model
44
+ # @see AuthorizerFinder#execute
91
45
  # @since wallaby-5.2.0
92
- def authorizer_of(model_class, authorizer_class = nil)
93
- authorizer_class ||= Map.authorizer_map(model_class, controller_to_get(:application_authorizer))
94
- authorizer_class.new model_class, self
46
+ def authorizer_of(model_class)
47
+ AuthorizerFinder.new(
48
+ script_name: script_name,
49
+ model_class: model_class,
50
+ current_controller_class: wallaby_controller
51
+ ).execute.create model_class, self
95
52
  end
96
53
  end
97
54
  end
@@ -3,42 +3,7 @@
3
3
  module Wallaby
4
4
  # Abstract related class methods
5
5
  module Baseable
6
- SUFFIX = /(Controller|Decorator|Servicer|Authorizer|Paginator)$/.freeze
7
- ATTR_NAME = 'model_class'
8
-
9
- # @param class_name [String]
10
- # @param attr_name [String]
11
- # @param suffix [String]
12
- # @param plural [String]
13
- # @return [Class] found associated class
14
- # @raise [Wallaby::ClassNotFound] if associated class isn't found
15
- def self.guess_associated_class_of(class_name, attr_name: ATTR_NAME, suffix: EMPTY_STRING, plural: false)
16
- base_name = class_name.gsub(SUFFIX, EMPTY_STRING).try(plural ? :pluralize : :singularize) << suffix
17
- parts = base_name.split(COLONS)
18
- parts.each_with_index do |_, index|
19
- begin
20
- # NOTE: DO NOT try to use const_defined? and const_get EVER.
21
- # This is Rails, use constantize
22
- return parts[index..-1].join(COLONS).constantize
23
- rescue NameError # rubocop:disable Lint/SuppressedException
24
- end
25
- end
26
-
27
- raise ClassNotFound, <<~INSTRUCTION
28
- The `#{attr_name}` hasn't been provided for Class `#{class_name}` and Wallaby cannot guess it right.
29
- If `#{class_name}` is supposed to be a base class, add the following line to its class declaration:
30
-
31
- class #{class_name}
32
- base_class!
33
- end
34
-
35
- Otherwise, please specify the `#{attr_name}` in `#{class_name}`'s declaration as follows:
36
-
37
- class #{class_name}
38
- self.#{attr_name} = CorrectClass
39
- end
40
- INSTRUCTION
41
- end
6
+ extend ActiveSupport::Concern
42
7
 
43
8
  # Configurable attributes:
44
9
  # 1. mark a class as a base class
@@ -80,37 +45,39 @@ module Wallaby
80
45
  # end
81
46
  # end
82
47
  # @return [Class] assigned model class or Wallaby will guess it
83
- # (see {Wallaby::Baseable.guess_associated_class_of .guess_associated_class_of})
48
+ # (see {Guesser.class_for})
84
49
  # @return [nil] if current class is marked as base class
85
- # @raise [Wallaby::ModelNotFound] if model class isn't found
50
+ # @raise [ClassNotFound] if model class isn't found
86
51
  # @raise [ArgumentError] if base class is empty
87
52
  def model_class
88
53
  return if base_class?
89
54
 
90
- @model_class ||= Baseable.guess_associated_class_of name
91
- rescue TypeError
92
- raise ArgumentError, <<~INSTRUCTION
93
- Please specify the base class for class `#{name}`
94
- by marking one of its parents `base_class!`, for example:
55
+ @model_class ||= Guesser.class_for(name) || raise(
56
+ ClassNotFound, <<~INSTRUCTION
57
+ The `model_class` hasn't been provided for Class `#{name}` and Wallaby cannot guess it right.
58
+ If `#{name}` is supposed to be a base class, add the following line to its class declaration:
59
+
60
+ class #{name}
61
+ base_class!
62
+ end
95
63
 
96
- class ParentClass
97
- base_class!
98
- end
99
- INSTRUCTION
64
+ Otherwise, please specify the `model_class` in `#{name}`'s declaration as follows:
65
+
66
+ class #{name}
67
+ self.model_class = CorrectModelClass
68
+ end
69
+ INSTRUCTION
70
+ )
100
71
  end
101
72
 
102
- # @!attribute [w] namespace
103
- # Used by `model_class`
104
- # @since wallaby-5.2.0
105
- attr_writer :namespace
73
+ # @deprecated
74
+ def namespace=(_namespace)
75
+ Deprecator.alert method(__callee__), from: '0.3.0'
76
+ end
106
77
 
107
- # @!attribute [r] namespace
108
- # @return [String] namespace
109
- # @since wallaby-5.2.0
78
+ # @deprecated
110
79
  def namespace
111
- @namespace ||=
112
- superclass.try(:namespace) \
113
- || name.deconstantize.gsub(/Wallaby(::)?/, EMPTY_STRING).presence
80
+ Deprecator.alert method(__callee__), from: '0.3.0'
114
81
  end
115
82
  end
116
83
  end