hello, how protect to_xml and disabled other format or accpet only html format example : if user type in url www.mysite/controller.xml , i want to redirect to another controller. it''s possible to use a routes to do that ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
one way would be a before_filter, e.g.
class ApplicationController < ActionController::Base
before_filter :trap_xml
def trap_xml
if params[:format] == ''xml'' && params[:action] !=
''my_xml_action''
redirect_to :controller => ''my_xml_controller'',
:action =>
''my_xml_action''
end
end
end
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
yes it''s this. thanks On 3 fév, 21:37, jemminger <jemmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> one way would be a before_filter, e.g. > > class ApplicationController < ActionController::Base > > before_filter :trap_xml > > def trap_xml > if params[:format] == ''xml'' && params[:action] != ''my_xml_action'' > redirect_to :controller => ''my_xml_controller'', :action => > ''my_xml_action'' > end > end > > end--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---