Skip to content

Commit abc65c7

Browse files
committed
Move class method and add module access control
The `included` class method was placed between two module definitions. This made it difficult to find lexically. This just moves it, white space update, to after all modules are defined and before the module methods are defined. This also marks the module's helper methods as `module_function` access. This means when they get included they will be private, thus not exposed to potential routing conflicts.
1 parent 4a24a3a commit abc65c7

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/kracken/controllers/json_api_compatible.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module Kracken
22
module Controllers
33
module JsonApiCompatible
44

5-
65
module MungeAndMirror
76
# Wraps the data root in an Array, if it is not already an Array. This
87
# will not wrap the value if the resource root is not present.
@@ -75,15 +74,6 @@ def verify_required_params(options = {})
7574
end
7675
end
7776

78-
def self.included(base)
79-
base.instance_exec do
80-
extend Macros
81-
82-
before_action :munge_chained_param_ids!
83-
skip_before_action :verify_authenticity_token
84-
end
85-
end
86-
8777
module DataIntegrity
8878
# Scan each item in the data root and enforce it has an id set.
8979
def enforce_resource_ids!
@@ -123,7 +113,17 @@ def resource_type
123113
end
124114
include VirtualAttributes
125115

116+
def self.included(base)
117+
base.instance_exec do
118+
extend Macros
119+
120+
before_action :munge_chained_param_ids!
121+
skip_before_action :verify_authenticity_token
122+
end
123+
end
124+
126125
# Common Actions Necessary in JSON API controllers
126+
module_function
127127

128128
# Wrap a block in an Active Record transaction
129129
#

0 commit comments

Comments
 (0)