[Rails] Error while embedding ruby code in fullcalendar jquery to display events
I am trying to display events on my fullcalendar. In my controller I am
getting an array of events. But I need to loop it and render it in view
page as events array. When I try to do loop it I am getting some syntax
error on which I have spent around 3-4 hours and couldn't figure it out.
Please help. Please find the code
> $(document).ready(function()
> Blockquote
{ $('#calendar').fullCalendar({
> editable: true,
> header: {
> left: 'prev,next today',
> center: 'title',
> right: 'month,agendaWeek,agendaDay'
> },
> height: 500,
> slotMinutes: 15,
>
> events: [<%@projects.each do
|p|%>{name:<%=p.name%>,start_date:<%=p.start_date%>,end_date:<%=p.end_date%>}<%end%>]
> });
> });
In my controller I get the @projects as an array.
But in the console I get the following error as
Timestamp: Thursday 25 October 2012 01:06:22 IST
Error: SyntaxError: missing } after property list
Source File: http://localhost:3000/dashboard?user=9
Line: 44, Column: 33
Source Code:
events: [{name: Online book store,start_date: 2012-01-10}{name: Customer
Service,start_date: 2012-10-18}],
The proper format which I need of this events array is as follows
events: [
{
title: 'All Day Event',
start: 28-10-2012
},
{
title: 'Long Event',
start: 25-10-2012,
},
{
title: 'Repeating Event',
start: 20-10-2012,
}
]
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home