File tree 4 files changed +7
-5
lines changed
generators/jsonapi/initializer/templates
4 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 22
22
# }
23
23
#
24
24
# # Set default exposures.
25
- # config.jsonapi_expose = {
26
- # url_helpers: ::Rails.application.routes.url_helpers
25
+ # # A lambda/proc that will be eval'd in the controller context.
26
+ # config.jsonapi_expose = lambda {
27
+ # { url_helpers: ::Rails.application.routes.url_helpers }
27
28
# }
28
29
#
29
30
# # Set a default pagination scheme.
Original file line number Diff line number Diff line change 1
1
require 'jsonapi/deserializable'
2
2
require 'jsonapi/serializable'
3
+ require 'jsonapi/rails/configuration'
3
4
require 'jsonapi/rails/railtie'
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ class Configuration < ActiveSupport::InheritableOptions; end
20
20
version : '1.0'
21
21
} . freeze
22
22
23
- DEFAULT_JSONAPI_EXPOSE = {
24
- url_helpers : ::Rails . application . routes . url_helpers
23
+ DEFAULT_JSONAPI_EXPOSE = lambda {
24
+ { url_helpers : ::Rails . application . routes . url_helpers }
25
25
} . freeze
26
26
27
27
DEFAULT_JSONAPI_PAGINATION = -> ( _ ) { nil }
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ def jsonapi_object
107
107
# Hook for default exposures.
108
108
# @return [Hash]
109
109
def jsonapi_expose
110
- JSONAPI ::Rails . config [ :jsonapi_expose ]
110
+ instance_exec ( & JSONAPI ::Rails . config [ :jsonapi_expose ] )
111
111
end
112
112
113
113
# Hook for pagination scheme.
You can’t perform that action at this time.
0 commit comments