redirect_to edit

controller, redirect, routes, ruby-on-rails, ruby-on-rails-3

Solution

You're trying to redirect to `edit_location_path(:id)`. The symbol `:id` is not what you want to pass here. You want the location's id or the location itself: `redirect_to edit_location_path(@location)`

Problem

I have quite a long form in my app so I've set up a `_new_form.html.erb` which is rendered in my `new.html.erb`. After the user updates this form and passes some basic validations I would like them to be redirected to the `edit.html.erb` which renders the full form, i.e. `_new_form.html.erb`. I'm sure this is basic stuff but I can't find out how to do it. I've tried updating the Create action in my Contoller with the below but I'm getting now where. i.e. ``` def create @location = Location.new(params[:location]) #redirect_to :action => "edit" respond_to do |format| if @location.save format.html { redirect_to edit_location_path(:id), notice: 'Location was successfully created.' } format.json { render json: @location, status: :created, location: @location } else format.html { render action: "new" } format.json { render json: @location.errors, status: :unprocessable_entity } end end end ```

Original source