On Viernes, 26 de Junio de 2009 13:05:31 jalberto escribió:
> Still playing with ACL9 authorization i find a strange behavior. If i
> use in the controller somethign like :
>
>   allow anonymous, :to => [:index, :show, :show_search]
>
>   rescue_from 'Acl9::AccessDenied', :with => :access_denied
>
>   def access_denied
>       if current_user
>         render :template => 'access_denied'
>       else
>         flash[:notice] = 'Access denied. Try to log in first.'
>         redirect_to login_path
>       end
>     end
>
> In a normal link (no-AS) it works well, but if try to click on "edit"
> for example i can see in logs:
>
>   Processing DevicesController#edit (for ::ffff:127.0.0.1 at
> 2009-06-26 13:01:42) [GET]
>   Parameters: {"action"=>"edit", "_method"=>"get",
> "adapter"=>"_list_inline_adapter", "id"=>"953125641",
> "controller"=>"devices"}
> Redirected to http://localhost:3000/login
>
> But the view is not redirected, just nothign happen.Maybe the best
> solution is to add a flash[:error] msg to AS so AS can show it like
> other errors (red background line on top).
> So the questin is how can i add messages to AS errors?

You need a different response for AJAX requests, to make a redirect from 
javascript:
respond_to do |format|
  format.html { redirect_to login_path }
  format.js do
    render(:update) {|page| page.redirect_to login_path}
  end
end
-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to