tag:blogger.com,1999:blog-5746251571102358624.post8175814109142394198..comments2023-07-04T05:27:31.763-07:00Comments on SteamCode: Ramaze, Full Calendar, JSON, and AJAXslabountyhttp://www.blogger.com/profile/06122119234374455724noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5746251571102358624.post-19881886750861712722009-09-16T08:52:31.005-07:002009-09-16T08:52:31.005-07:00Kez,
That's pretty much where I ended up with...Kez,<br /><br />That's pretty much where I ended up with my "real" applicaton (except I'm not clever enough to remember to use map). The one thing I did do was have the model have a method for getting just the dates being asked for and it looks something like:<br /><br /> def self.all_by_dates(startDate, endDate)<br /> filter(:date => startDate..endDate).all<br /> end<br /><br />This will give only the dates for the month in question. Then you can use your function on fewer items and pass fewer items to the view.<br /><br />Thanks for sharing the code!slabountyhttps://www.blogger.com/profile/06122119234374455724noreply@blogger.comtag:blogger.com,1999:blog-5746251571102358624.post-42323658990120296392009-09-16T08:36:42.980-07:002009-09-16T08:36:42.980-07:00I implemented FullCalendar in Ramaze yesterday, af...I implemented FullCalendar in Ramaze yesterday, after your post, and thought it would be good to share JSON structure generation from a Sequel model...<br /><br />....<br />@events = Events.select(:id, :name, :date).order(:date.asc).all<br />json = JSON.generate @events.map{|x,y| {"id" => x[:id], "title" => x[:name], "start" => x[:date].strftime('%Y-%m-%d')} }<br />respond(json,200)<br />....<br /><br />(Pastie: http://paste.ramaze.net/32128)<br /><br />It's working rather nicely for one line of Ruby.kezhttps://www.blogger.com/profile/04471786810119116390noreply@blogger.com