Hola a todos:
En un controlador tengo el siguiente método:
def search
return unless request.post?
@enterprise = Enterprise.find_by_cif(params[:cif])
respond_to do |format|
format.html
format.xml{ render :action => 'search.rxml', :layout => false}
end
rescue ActiveRecord::RecordNotFound
respond_to do |format|
format.html
format.xml{ render :action => 'search.rxml', :layout => false}
end
end
El problema viene que con rutas estilo
localhost:3001/cif/search/un_cif.xml me intenta renderizar el rhtml.
¿Qué falla? En el log tengo lo siguiente:
Processing CifController#search (for 127.0.0.1 at 2007-09-18 12:03:11)
[GET]
Session ID: fd32bdddea9b7eff73d86123582cb654
Parameters: {“format”=>“xml”, “action”=>“search”, “id”=>“adad”,
“controller”=>“cif”}
Rendering cif/search
Completed in 0.01130 (88 reqs/sec) | Rendering: 0.00136 (12%) | 200 OK
[http://localhost/cif/search/adad.xml]
Por otra parte, si en el routes intento hacer algo estilo
map.connect ‘cif/:cif’, :controller => ‘cif’, :action => ‘search’
¿Cómo hago para que siga conservando la posibilidad de añadir los .xml?
Un saludo y muchas gracias,
Serabe