Skip to content

Instantly share code, notes, and snippets.

@johno
Created November 12, 2013 18:10
Show Gist options
  • Save johno/7435847 to your computer and use it in GitHub Desktop.
Save johno/7435847 to your computer and use it in GitHub Desktop.
# 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