Created
April 18, 2011 16:51
-
-
Save Sailias/925686 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope :current, where(:current=>true} | |
validate :only_one_current | |
protected | |
def only_one_current | |
errors.add_to_base("Only one event can be current") if Event.current.reject{|c| c.eql?(self)}.size>0 | |
end | |
def before_create | |
if self.current? | |
Event.current.last.update_attribute("current", false) | |
end | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get "current_event" => "events#current_event" | |
get "current_event/days" => "days#current_days" | |
get "current_event/days/registrants" => "registrants#current_registrants" | |
get "current_event/days/registrants" => "registrants#search" | |
get "current_event/days/registrants" => "registrants#all_schedules" | |
get "current_event/days/registrants" => "registrants#schedule" | |
get "current_event/days/registrants" => "registrants#edit_attendance" | |
post "current_event/days/registrants" => "registrants#update_attendance" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment