Created
October 2, 2014 20:26
-
-
Save stimms/35951b118209b2e8ef88 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
if(customers != null) | |
if(customers.Count() > 0) | |
if(customers.FirstOrDefault().Orders != null) | |
if(customers.FirstOrDefault().Orders.Count() >0) | |
if(customers.FirstOrDefault().Orders.First().Address != null) | |
return customers.FirstOrDefault().Orders.First().Address.First.Zip; |
Eh... You can code around it, most of this is just sugar on top of .limit(1) calls.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Orders.find_by(customer: customer).try(:address) || "No Address"