How to access cookies from ApplicationController (Rails)
It's a hash, not a method:
cookies[:some_key]
... instead of:
cookies(:some_key)
This might work for you:
class ApplicationController
before_filter :handle_cookies
def handle_cookies
# Do whatever it is you want to do with your cookies
end
end
The before_filter
method will call whatever subroutine you indicate (:handle_cookies
) after cookies
has been compiled into a hash. Adding this code to your application controller will mean that all the other controllers inherit it and will perform the same function.