Is it possible to run some script before controller is hit

17 views
Skip to first unread message

Damjan Rems

unread,
Jun 3, 2013, 2:07:22 AM6/3/13
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.

Dheeraj Kumar

unread,
Jun 3, 2013, 2:10:28 AM6/3/13
to rubyonra...@googlegroups.com
I'd do this in the client site - with javascript.

-- 
Dheeraj Kumar

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.

Frederick Cheung

unread,
Jun 3, 2013, 3:12:28 AM6/3/13
to rubyonra...@googlegroups.com


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 ( https://github.com/peter-murach/rack-policy ) that handles some of this.

Fred

Robert Walker

unread,
Jun 3, 2013, 8:44:48 AM6/3/13
to rubyonra...@googlegroups.com
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.

Colin Law

unread,
Jun 3, 2013, 10:17:50 AM6/3/13
to rubyonra...@googlegroups.com
On 3 June 2013 07:07, Damjan Rems <li...@ruby-forum.com> 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
Reply all
Reply to author
Forward
0 new messages