Reputation: 1177
Is there a way I can see the contents of a hash that is being sent in by of form or a link in rails?
Upvotes: 0
Views: 1575
Reputation: 6808
The parameters sent to the request is printed to your log file in development.
If you look at the last few hundred lines of log/development.log
you will find something that looks roughly like:
Started GET "/?page=2" for 127.0.0.1 at 2012-07-01 03:05:05 -0600
Processing by ListsController#index as JSON
Parameters: {"page"=>"2"}
You can enhance this by inspecting the object from your controller or, as mentioned by Ben.
You can have this output to the logfile by using Rails.logger.debug params.inspect
or output it in the response from your view by doing <%= params.inspect %>
Upvotes: 3
Reputation: 7403
In your controller method, just inspect the params
hash. For example,
class UsersController < ApplicationController
def index
puts params.inspect
end
end
You can also view these params as part of the request using something like Chrome Developer Tools or Firebug.
Upvotes: 9