On Jueves, 10 de Febrero de 2011 20:41:43 Soren escribió: > Hi > > I have a controller in which I need to redirect the user to the new > action if there are no elements in the controller. Needless to say > that I use AS for this controller. > > I just added an override like this to the index action: > > > def index > if something? > redirect_to new_xxx_path > else > super > end > end > > This happens to work great! Just wondering if this is the right/ > recommended way to do this, so I'm not placing a problem for myself in > the future. > > Could you even place this at the application_controller level and have > it as a "super action" to catch misguided users that are trying to go > their own ways and do the wrong things ?
It's ok, but I think it's better to use a before_filter before_filter :redirect_to_new, :only => :index # or [:index, :list] def redirect_to_new redirect_to new_xxx_path if something? end > > /S -- 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.
