Created
November 6, 2015 08:11
-
-
Save kirkelifson/313867b8bd9ec9d7a047 to your computer and use it in GitHub Desktop.
rails: all_nil? -- returns true if list of object attributes are nil
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
def all_nil?(object, *options) | |
options.map { |item| object.send(item) }.compact.empty? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment