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.


Dheeraj K.

On Monday, June 3, 2013 7:07:22 AM UTC+1, Ruby-Forum.com User wrote:

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 ( GitHub - piotrmurach/rack-policy: Rack middleware for the EU ePrivacy Directive compliance in Ruby Web Apps
)
that handles some of this.

Fred

On 3 June 2013 07:07, Damjan R. [email protected] wrote:

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.

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

Colin

Dheeraj K. 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.