1

I'm using FullCalendar in my app and feed it with a JSON file for the appointments.

I recently introduced few conditional but this is the error I get when try to load the appointments.json page

index.json.jbuilder:15: syntax error, unexpected keyword_end, expecting end-of-input

Here is my code to generate the json file with jbuider

json.array! @appointments do |a|
json.ignore_nill!
  json.extract! a, :id, :description, :patient_id

  if a.patient.blank? && a.description.blank?
    json.title "Appuntamento"
  end

  if a.patient.blank? && a.description.present?
    json.title a.description
  end

  if a.patient.present? && a.description.present?
    json.title a.patient.fullname_lastnameFirst + "\n" + a.description.capitalize
  end

  if a.seat.blank?
    json.color "rgb(122, 122, 122)"
  else
    json.color a.seat.color
  end

  json.start a.starting_time
  json.end a.ending_time
  json.url appointment_url(a)

end

Any idea where it could be the problem with the missing end of input? Thanks already for the help

  • Running this through `ruby -c` says the syntax is OK. Could the problem be elsewhere? – Eyeslandic Jan 08 '17 at 10:59
  • `end` in the `json.end a.ending_time` line is weirdly highlighted as ruby block ending. Maybe that's issue? – VAD Jan 08 '17 at 11:57
  • it is probably in code where this snippet is. you either unterminated some block with `end`, or didn't type `do` for some method that accepts block (for that block). – ClassyPimp Jan 08 '17 at 14:37
  • I'm not sure but I noticed somehow a connection with the model causing this error. For now I got back to the previous version (which used to work). Trying different edits... thanks for the help – Diego Di Salvo Jan 08 '17 at 22:36

0 Answers0