Reputation: 14866
Ok, so I know that the client sends cookies to the server. I'm working on a legacy rails app and I just want to access a particular cookie if it exists. I need to do this in application_controller.rb
. To start, how do I simply list each cookie that was sent along with it's value? Thanks much.
Upvotes: 9
Views: 6276
Reputation: 1275
For a nicer output:
Rails.logger.debug(cookies.map { |cookie| cookie.join('=') }.join("\n"))
And watch your Rails log.
Upvotes: 4
Reputation: 3985
In your controller try the following:
cookies.each do |cookie|
puts cookie
end
cookie[0]
will be the name and cookie[1]
will be the value.
Upvotes: 14