+ <%= render(:partial => 'messages') %> +
+ <% else %> + <%= link_to 'Back', :back %> + <% end %> +
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b4b2114..6cd30c3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,15 @@ class ApplicationController < ActionController::Base before_filter :authenticate_user! include SentientController protect_from_forgery + + rescue_from CanCan::AccessDenied, ActiveScaffold::ActionNotAllowed do |exception| + flash.now[:error] = exception.message + render :template => 'errors/access_denied', :layout => 'errors' + end + + rescue_from ActiveScaffold::ActionNotAllowed do |exception| + flash.now[:error] = I18n.t("action_not_allowed") + render :template => 'errors/access_denied', :layout => 'errors' + end + end diff --git a/app/views/errors/_messages.html.erb b/app/views/errors/_messages.html.erb new file mode 100644 index 0000000..4d87e19 --- /dev/null +++ b/app/views/errors/_messages.html.erb @@ -0,0 +1,10 @@ +<% for name in [:info, :warning, :error] %> + <% if flash[name] %> +