views:

226

answers:

1

I've got fullcalendar working with a small rails app (yeah) but it's sluggish because the find in my controller is finding ALL the records before it renders the calendar. I'm using a JSON approach. The field names I'm using are starts_at and ends_at. This (in the index method of the assignments_controller) works:

@assignments = Assignment.find(:all, :conditions => "starts_at IS NOT NULL")

But, as I said, it's pokey, and will only get worse as more records get added. So this is clearly more of a rails question than a fullcalendar question: I can't figure out how to get fullcalendar to initially display the current week (when no parameters have been sent) and then accept parameters from next/previous buttons while, in either case, only looking up the relevant items from the database.

Oh - this is rails 2.x, NOT 3.

Thanks for any pointers.

A: 

Please ignore this question. It turned out to be an issue with Date format inconsistencies between JavaScript (Epoch) and Ruby. At least that's what I think at the moment. I'm still scratching my head, trying to figure out how exactly I "fixed" it, but it seems to be working. I was aware of this project: http://github.com/bansalakhil/fullcalendar but it took me ages to get the nuance of Time.at figured out.

I must say, Time is a tricky thing. In real life as well as in code.

Thanks to everyone who gave my (misguided, as it turned out) question a glance.