Hi everyone, I''m new to rails. My application has 3 modules: Admin, Xml, Flash. I wrote a before_filter in the application.rb that check if the user is authenticate (my own, not the plugins). Everything work right, but now that I split my apps in 3 modules, I don''t know how to apply the security just on the Admin module. Of course, I can add the before_filter in each controller under Admin module, But I looking for a global way to do it. I would like to don''t have to add the filter on each new controller of the Admin module. Is there a way of doiing this? Thanks P.S. Sorry for the bad english. I''m french --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Carl Pelletier wrote:> I wrote a before_filter in the application.rb that check if the user is > authenticate (my own, not the plugins). Everything work right, but now > that I split my apps in 3 modules, I don''t know how to apply the > security just on the Admin module. > > Of course, I can add the before_filter in each controller under Admin > module, But I looking for a global way to do it. I would like to don''t > have to add the filter on each new controller of the Admin module. > > Is there a way of doiing this?Create a base class for all your admin controllers and add your before_filter to that. Then you can inherit from the base class to use the authentication. class Admin::BaseController < ApplicationController before_filter :do_authentication end class Admin::MyAdminController < Admin::BaseController end -- Phil Ross http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---