0

I have a page which displays information of a Hotel. The model used here is 'Hotel' Route: localhost:3000/hotel/3

I have a pop-over form for a guest to send her requirement. This uses a different model 'GuestQueries'

I need to redirect guest back to localhost:3000/hotel/3 with a success message. If the success fails then I want to render the pop-up back with errors.

I can't figure out how to handle the routes in case of successful save and in case of errors.

I am using nested routes.

Sonali Gupta
  • 288
  • 1
  • 5
  • 17
  • 1
    If you want to do that, you should use xhr/ajax (so `remote: true` on your form), and in the rendered js either re-render the pop-up content, or close the pop-up and show the success message. – nathanvda Dec 17 '14 at 13:02
  • I am not sure if I got everything correctly. Basically, I am saving the form in GuestQueries#create Controller. If the save succeeds I redirect to @hotel. I have no clue what should my render look like in case of a failed save. – Sonali Gupta Dec 17 '14 at 20:39

0 Answers0