Created
September 14, 2015 23:23
-
-
Save johana-star/beca99f3e868d8a17e14 to your computer and use it in GitHub Desktop.
A way to fing the first thing that matches or set to nil
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
grading_period = nil | |
@context.courses.each do |course| | |
break if grading_period = GradingPeriod.context_find(course, params[:grading_period_id]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
detect
? http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-detect