Created
May 14, 2014 17:46
-
-
Save ahimmelstoss/25e359a760395ecfec5b 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
host_user = User.new | |
host_user.name = "Host User" | |
host_user.save | |
guest_user = User.create(:name => "Guest User") | |
not_attending_user = User.create(:name => "Not Attending User") | |
attending_user = User.create(:name => "Attending User") | |
birthday = Event.create(:name => "Birthday", :host => host_user) | |
holiday_party = host_user.hosted_events.create(:name => "Holiday Party") | |
# birthday.host_id = 1 # 2 details, column and literal value | |
# birthday.host_id = host_user.id # 1 detail, column | |
# birthday.host = host_user # 0 details, just an attribute | |
Invite.create(:event => birthday, | |
:guest => guest_user, | |
:status => true) | |
birthday.invites.create(:guest => not_attending_user, :status => false) | |
attending_user.invites.create(:event => holiday_party, :status => true) | |
birthday.guests << guest_user | |
holiday_party.guests << guest_user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment