Skip to content

Commit 1bbf3e4

Browse files
committed
Adds ResourceControllerMetal
and reverts ResourceController back to using ActionController::Base
1 parent 2a22bd0 commit 1bbf3e4

4 files changed

Lines changed: 21 additions & 15 deletions

File tree

lib/jsonapi-resources.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require 'jsonapi/response_document'
44
require 'jsonapi/acts_as_resource_controller'
55
require 'jsonapi/resource_controller'
6+
require 'jsonapi/resource_controller_metal'
67
require 'jsonapi/resources/version'
78
require 'jsonapi/configuration'
89
require 'jsonapi/paginator'

lib/jsonapi/resource_controller.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
module JSONAPI
2-
class ResourceController < ActionController::Metal
3-
MODULES = [
4-
AbstractController::Rendering,
5-
ActionController::Rendering,
6-
ActionController::Renderers::All,
7-
ActionController::StrongParameters,
8-
ActionController::ForceSSL,
9-
ActionController::Instrumentation,
10-
JSONAPI::ActsAsResourceController
11-
].freeze
12-
13-
MODULES.each do |mod|
14-
include mod
15-
end
2+
class ResourceController < ActionController::Base
3+
include JSONAPI::ActsAsResourceController
164
end
175
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module JSONAPI
2+
class ResourceControllerMetal < ActionController::Metal
3+
MODULES = [
4+
AbstractController::Rendering,
5+
ActionController::Rendering,
6+
ActionController::Renderers::All,
7+
ActionController::StrongParameters,
8+
ActionController::ForceSSL,
9+
ActionController::Instrumentation,
10+
JSONAPI::ActsAsResourceController
11+
].freeze
12+
13+
MODULES.each do |mod|
14+
include mod
15+
end
16+
end
17+
end

test/fixtures/active_record.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ class Customer < Customer
546546
end
547547

548548
### CONTROLLERS
549-
class AuthorsController < JSONAPI::ResourceController
549+
class AuthorsController < JSONAPI::ResourceControllerMetal
550550
end
551551

552552
class PeopleController < JSONAPI::ResourceController

0 commit comments

Comments
 (0)