Rails 4 json response only after refreshing the page -
I am using the response_to block to feed some JSN in a calendar.
Answer_ | Format | Format.html format.json {render json: @reservations, root: false} end Jason has been formatted using the active_model_serializers gem.
class reservation surrealizer & lt; ActiveModel :: Serializer included rail. Application Routes.url_helpers def attributes super.merge (start: object.reservation_start, end: object.reservation_end, title: object.user.username, url: edit_reservation_path (object), color: object.transport localhost: 3000
code> and , my calendar is empty, but after refreshing the page, the data is there. Also, if I go to localhost: 3000 / reservation Everything works fine then I have javascript / property I was writing to debug some console.log and javascript was being loaded for the calendar normaly.
Calendar initializer:
$ (". Calendar"). FullCalendar lang: 'pt-BR' Event: gon.path time format: "hh: mm" display item: true eventDrop: updateEvent eventResize: UpdateEvent console.log ("test")
Comments
Post a Comment