Skip to content

Instantly share code, notes, and snippets.

@danielspaniel
Created August 16, 2011 01:34
Show Gist options
  • Save danielspaniel/1148270 to your computer and use it in GitHub Desktop.
Save danielspaniel/1148270 to your computer and use it in GitHub Desktop.
class Event < ActiveRecord::Base
belongs_to :business
serialize :schedule
EVENT = 0
SPECIAL = 1
ANNOUNCEMENT = 2
attr_writer :start_date, :start_time_hour, :start_time_minute,
:start_time_am_pm,:end_date, :end_time_hour, :end_time_minute,
:end_time_am_pm, :recur_value, :recur_until_date
end
class EventDecorator < Draper::Base
decorates :event
def start_date
start_time.strftime("%m/%d/%Y")
end
def start_time_hour
start_time.strftime("%H")
end
def start_time_minute
start_time.strftime("%M")
end
def start_time_am_pm
start_time.strftime("%p")
end
def end_date
end_time.strftime("%m/%d/%Y")
end
def end_time_hour
end_time.strftime("%H")
end
def end_time_minute
end_time.strftime("%M")
end
def end_time_am_pm
end_time.strftime("%P")
end
end
en:
activerecord:
models:
member: Event
attributes:
event:
start_time: From
end_time: To
event_type_0: Event
event_type_1: Special
event_type_2: Announcement
recur_value_once: Once
recur_value_day: Daily
recur_value_week: Weekly
recur_value_month: Monthly
recur_until_date: ending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment