Skip to content

Instantly share code, notes, and snippets.

@mrmans0n
Last active December 10, 2015 23:28
Show Gist options
  • Select an option

  • Save mrmans0n/4509927 to your computer and use it in GitHub Desktop.

Select an option

Save mrmans0n/4509927 to your computer and use it in GitHub Desktop.
Solving rails-api and wrap_parameters problem
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
include ActionController::ParamsWrapper
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment