Last active
August 29, 2015 14:04
-
-
Save MichaelCPell/546e2a722682d87ce70d 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
Your smallest next problem: | |
Make this command: | |
rails console$ Course.first.exercises | |
Produce (something like) this result: | |
>[{exercise 1 info}, {exercise 2 info}] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
2.0.0-p247 :002 > Course.first.exercises
Course Load (4.8ms) SELECT "courses".* FROM "courses" ORDER BY "courses"."id" ASC LIMIT 1
Exercise Load (16.9ms) SELECT "exercises".* FROM "exercises" WHERE "exercises"."course_id" = ? [["course_id", 1]]
=> #<ActiveRecord::Associations::CollectionProxy [#<Exercise id: 1, title: nil, body: "Primer ejercicio", course_id: 1, created_at: "2014-07-20 17:46:07", updated_at: "2014-07-20 17:46:07">, #<Exercise id: 2, title: nil, body: "Segundo ejercicio", course_id: 1, created_at: "2014-07-20 17:48:19", updated_at: "2014-07-20 17:48:19">]>
2.0.0-p247 :003 >