Created
February 6, 2013 17:20
-
-
Save blamattina/4724170 to your computer and use it in GitHub Desktop.
In reference to http://stackoverflow.com/questions/14729984/rails-3-each-do-ignore-nil-values/14730168#comment20616258_14730168
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
## in rating.rb | |
# not the best method name.. | |
# call it with name.rat1.display_rating | |
def display_rating | |
read_attribute(:rating).presence || "N/A" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment