views:

14

answers:

0

How would you implement a modal window saying "In order you to access this area you have to be logged in.." in combination with a login form below it every time a user tries to access authorized content. I'm using Rails 3, Devise and CanCan.

My first thoughts were do put it somewhere in the application_controller.rb:

# application_controller.rb
rescue_from CanCan::AccessDenied do |exception|
  flash[:error] = "Access denied."
  redirect_to root_url
end