Skip to content

Instantly share code, notes, and snippets.

@libryder

libryder/output Secret

Created January 19, 2013 15:05
Show Gist options
  • Save libryder/39ab474037b817607c0f to your computer and use it in GitHub Desktop.
Save libryder/39ab474037b817607c0f to your computer and use it in GitHub Desktop.
[27] pry(#<User>)> solutions
=> [#<Solution id: 1, solution_url: nil, challenge_id: 1, user_id: 2, valid_solution: nil, created_at: "2013-01-19 14:51:04", updated_at: "2013-01-19 14:51:04", source: "Sample solution notes", title: "Some random title", language: "ruby", popularity: 2>]
[28] pry(#<User>)> solutions.inject { |sum, s| sum + s.up_votes.count }
=> #<Solution id: 1, solution_url: nil, challenge_id: 1, user_id: 2, valid_solution: nil, created_at: "2013-01-19 14:51:04", updated_at: "2013-01-19 14:51:04", source: "Sample solution notes", title: "Some random title", language: "ruby", popularity: 2>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment