Search code examples
ruby-on-railsruby-on-rails-3.2thinforemanrails-api

Is it okay to comment out the `wrap_parameters` initializer?


I was getting this error on starting my Rails-API app with Foreman and Thin.

AM@~/Documents/RailsWS/app1229 >foreman start
09:47:39 web.1  | started with pid 773
09:47:44 web.1  | => Booting Thin
09:47:44 web.1  | => Rails 3.2.8 application starting in development on   
  http://0.0.0.0:5000
09:47:44 web.1  | => Call with -d to detach
09:47:44 web.1  | => Ctrl-C to shutdown server
09:47:45 web.1  | Exiting
09:47:45 web.1  | 
 /Users/AM/Documents/RailsWS/app1229/config/initializers/wrap_parameters.rb:8:in 
 `block in <top (required)>': undefined method `wrap_parameters' for 
 ActionController::API:Class (NoMethodError)

After spending hours trying to debug it I was unsuccessful and so finally decided to try a hack: I commented out this line in the initializers/wrap_parameters.rb file in the project like so:

ActiveSupport.on_load(:action_controller) do
  #wrap_parameters format: [:json] 
end

This seemed to solve the immediate problem, in that the Thin server boots up and runs. However, I'm not sure what the impact on this would be on the app. Is this safe to do in a Rails-API app which uses the Rabl gem to server JSON?

I referenced the Active Resources section of Agile Web Development with Rails (Ed. 4) as well.


Solution

  • I scrapped the rails api project and now Im rewriting it as a full rails app.