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 ?
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 ?
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
yes it's this. thanks