Created
March 30, 2016 03:02
-
-
Save alexgriff/8cf183b54d9ce945cf3a225f2f1952e0 to your computer and use it in GitHub Desktop.
This file contains 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
candidate = FactoryGirl.create :candidate, :with_many_voters | |
# => <Candidate id: 1534, position_running_for: "President", first_name: "Rudolph", | |
# last_name: "Carter", personality_type: "Brave, Hasty", | |
# bio: "Ut molestiae maiores non corporis. Voluptatem eum ...", political_views: nil, national_candidate: true> | |
candidate.votes | |
# => #<ActiveRecord::Associations::CollectionProxy | |
# [#<Vote id: 1544, voter_id: 556, candidate_id: 1534>, | |
# #<Vote id: 1545, voter_id: 557, candidate_id: 1534>, ... | |
# #<Vote id: 1553, voter_id: 565, candidate_id: 1534>]> | |
voter = candidate.votes.first.voter | |
# => #<Voter id: 563, ssn: "832-90-0169", birthdate: "1979-04-11", | |
# address: "152 Mozelle Underpass", state: "Florida", registration_status: true, | |
# first_name: "Dallas", last_name: "Hagenes"> | |
voter.votes.last.candidate == candidate | |
# => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment