Is it possible to run some script before controller is hit

This has everything to do with new European cookie law ;-(

Is it possible to start some script (on every call), before rails
application is hit. Script would check for the presence of a cookie and
if it is there just pass control forward. If not it would popup window
about legal stuff and redirect to original address.

I am using Rails 3.2 with Passenger and Nginx.

by
TheR

I’d do this in the client site - with javascript.

This has everything to do with new European cookie law ;-(

Is it possible to start some script (on every call), before rails

application is hit. Script would check for the presence of a cookie and

if it is there just pass control forward. If not it would popup window

about legal stuff and redirect to original address.

There’s a rack middleware ( https://github.com/peter-murach/rack-policy ) that handles some of this.

Fred

Dheeraj Kumar wrote in post #1111091:

I'd do this in the client site - with javascript.

JavaScript can easily be disabled by the user. The solution has to be
done server side, so Rack middleware is the way to go as Frederick
mentioned.

Out of interest is there a reason why this could not be done more
simply using a before_filter?

Colin