Skip to content

Instantly share code, notes, and snippets.

@m3talsmith
Created May 7, 2013 05:20
Show Gist options
  • Save m3talsmith/5530414 to your computer and use it in GitHub Desktop.
Save m3talsmith/5530414 to your computer and use it in GitHub Desktop.
fancy calendar fun
class CalendarItem < Section
include Mongoid::Document
field :url
def calendar
Icalendar.parse(open(self.url).read).first
end
end
class CalendarItemsController < ActionController
def create
@calendar_item = CalendarItem.create(params[:calendar_item])
redirect_to @calendar_item
end
def show
@calendar_item = CalendarItem.find(params[:id])
end
end
%h1 Fancy Calendar View for #{@calendar_item.url}
%h2 Events
- @calendar_item.calendar.events.each do |event|
%p= event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment