Created
October 24, 2008 17:48
-
-
Save trek/19523 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
| class Conference | |
| has_many :attendees, :class_name => 'Person', :through => :attendance | |
| def Conference.next_upcoming | |
| self.find!(:first, :conditions => ['starting_at > ? and visibile = ?' Time.now, true]) | |
| rescue RecordNotFound | |
| self.most_recent | |
| end | |
| def most_recent | |
| ... | |
| end | |
| end | |
| class Attendance | |
| belongs_to :conference | |
| belongs_to :person | |
| end | |
| class Person | |
| has_many :conference, :through => :attendance | |
| before_create :salt_password, :encrypt_password | |
| def salt_password | |
| ... | |
| end | |
| def encrypt_password | |
| ... | |
| end | |
| end | |
| class ConferencesController | |
| def current | |
| Conferences.next_upcoming | |
| end | |
| end | |
| class AttendencesController | |
| def create | |
| Attendence.create(params[:attendence]) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment