Ruby on Rails Wednesday, June 29, 2016

About the end, its could be that a 'do' is missing a 'else' is incorrect, or a missed an 'end' somewhere.

On Wed, Jun 29, 2016 at 4:39 PM, Ruth Stephenson <> wrote:
Than you so much for your reply and your help! I'm still a little
confused however as I'm still getting an error:

syntax error, unexpected end-of-input, expecting keyword_end

I don't know why it's complaining about end keywords. As far as I can
tell they are ok.

appointments controller:

def create  #(needs end 1)
    @appointment =

      respond_to do |format|  #(needs end 2)
      unless @appointments.isValid?  #(needs end 3)

        if  #(needs end 4)
          format.html { redirect_to @appointment, notice: 'Appointment
was successfully created.' }
          format.json { render :show, status: :created, location:
@appointment }
          format.html { render :new }
          format.json { render json: @appointment.errors, status:
:unprocessable_entity }
          redirect_to root_path
        end #(end 4)
    end #(end 3)
  end #(end 2)

Where is "end 1"?  Your indentation is hiding the problem from you as the "unless..." isn't indented further than the "respond_to do ..."


No comments:

Post a Comment