Created
November 12, 2013 18:10
-
-
Save johno/7435847 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
# Replace me. | |
def base_subscription | |
self.subscriptions.reverse.each do |sub| | |
return sub if sub.active and sub.plan.service_type == 'standard' | |
end | |
return nil | |
end | |
# With me. | |
def base_subscription | |
self.subscriptions.reverse.find { |sub| sub.active && sub.plan.service_type == 'standard' } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment