After an error, you really don't want to redirect, just re-render. That's how 
you keep all the request variables alive. If you need to render a different 
form from a different path, just pass in that path to your controller. 
Remember, in the error side of the if/else, there is an implicit render 
template: [:new or :edit]. So you can also write render template: 
'path/to/custom/view' there. The rest of the variables will already be there.

Walter

> On Feb 24, 2017, at 1:10 PM, fugee ohu <[email protected]> wrote:
> 
> my controller is user_posts_controller.rb
> it's views are in /app/views/user/posts
> 
> when a form submission fails to save the object i wanna redirect back to the 
> custom pathed form i came from but the controller code has render :new
> 
> how do i redirect to the calling path of new and pass parameters
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/7d236498-eaa6-4eed-8007-0f02acba3b99%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4140E2A5-7236-4EB3-B5AF-F9E33AB68EA7%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to