Created
November 8, 2012 15:44
-
-
Save kenton/4039575 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
rp.total_discounts_amt = 0.0 | |
rp.total_discounts_amt? | |
#=> false | |
so rp.total_discounts_amt? ? do_this_if_true : do_this_if_false | |
#=> always evaluates to do_this_if_false | |
but rp.total_discounts_amt.present? ? do_this_if_true : do_this_if_false | |
#=> will work as expected based on if value is present or nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a || 1.0