# Question about render

**URL:** <https://www.ruby-forum.com/t/question-about-render/149228>\
**Category:** Rails\
**Created:** [September 22, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/question-about-render/149228 "2008-09-22T18:14:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90ced4/32.png) [@davox](https://www.ruby-forum.com/u/davox)\
**Post date:** [September 22, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/question-about-render/149228/1 "2008-09-22T18:14:17Z")

</div>

Hi there, i have a question respect to the “render”

when use render in the controller

def create  
@contacto = Contacto.new(params[:contacto])  
respond\_to do |format|  
if @contacto.save  
flash[:notice] = ‘Su Consulta ha sido enviada’  
crear\_correo(@contacto)  
format.html { redirect\_to(:action =\> :new) }  
else  
format.html { render :controller =\> :contactos, :action =\> :new  
}  
end  
end  
end

when the form have an error ,they should show error… and do it.

but the url ‘contactos/new’ to ‘contactos’

then if i use redirect\_to … the form don’t show the errors

my question…how i do keep the url?

sorry for my language D=

thx for the help!

---

<div class="post-metadata">

**Author:** ![davox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90ced4/32.png) [@davox](https://www.ruby-forum.com/u/davox)\
**Post date:** [September 23, 2008, 7:25am UTC](https://www.ruby-forum.com/t/question-about-render/149228/2 "2008-09-23T07:25:52Z")

</div>

Why do you want to keep the same URL? As you noticed, you definitely  
want to do a render, not a redirect. If you want to keep the /  
contactos/new URL, then you’ll need to break the Rails restful  
conventions. By convention, a GET of /contactos/new will POST to /  
contactos. You could change your routing to something like this:  
map.connect “/contactos/new”, :controller =\> “contactos”, :action =\>  
“create”, :conditions =\> {:method =\> :post}

However, I would try to use the convention unless you have a strong  
reason for posting to /new.

-Dan M.  
[http://www.dcmanges.com/blog](http://www.dcmanges.com/blog)

On Sep 22, 11:14 am, David navarrete David \<rails-mailing-l…@andreas-
