Ruby on Rails Wednesday, June 29, 2016

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.

I don't understand what you mean when you say:
"# @appointments has not been loaded, is nil, you will get an error
# you can add a before_action filter and load it there
@appointments.find(params[:date, :timeslot]) # dont load this here
since is not always needed"

Isn't the @appointments.find(params[:date, :timeslot]) not instanciated
in the index method above?

Do you mean to put a before_action filter in the appointments

appointments controller:

def create
@appointment =

respond_to do |format|
unless @appointments.isValid?

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

appointments Model:

class Appointment < ActiveRecord::Base

def isValid?
date.present? && timeslot.present?

Posted via

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
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment