javacoder javacoder - 9 months ago 75
Ruby Question

The address directs me to the child?

I got two models; film model is the parent and the review model is the child. I expect the following code to direct me back to the film interface:

def create
@film = Film.find(params[:film_id])
@review =
redirect_to film_path(@film)
render "films/#{}"

It renders me back to the following address: films/22/reviews when it suppose to direct me back to the same interface (films/22)?

I want to return back to the same interface so i can post the errors the user has made?

Answer Source

Try it in else part

flash[:alert] = @review.errors.full_messages.join(',  ') 
redirect_to :back