You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-1
Original file line number
Diff line number
Diff line change
@@ -60,13 +60,15 @@ This method requires HTTP status code and an optional parameter explaining the e
60
60
## Configuration
61
61
Currently you can only configure which options are required to be passed through the `respond_with` method. These required options are categorized by the controller's actions. Bellow you can find an example:
62
62
63
+
# config/initializers/json_api_responders.rb
63
64
JsonApiResponders.configure do |config|
64
65
config.required_options = {
65
66
index: [:each_serializer],
66
67
create: [:serializer]
67
68
}
68
69
end
69
-
...
70
+
71
+
# app/controllers/v1/users_controller.rb
70
72
def create
71
73
user = User.create(...)
72
74
respond_with user, serializer: UserSerializer
@@ -90,13 +92,15 @@ If `:serializer` was left out of the above `respond_with` method you would see t
0 commit comments