Created
September 30, 2014 19:33
-
-
Save muloka/1927b2abaa05e6b098d5 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
<!-- | |
# ([].each {}).empty? | |
# .each returns the enumerator | |
# the block itself returns an array | |
--> | |
<% if @messages.each do |message| %> | |
<%# code or partial to display the message %> | |
<% end.empty? %> | |
You have no messages. | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to @trooney for showing me this: http://stackoverflow.com/questions/1027871/rails-an-elegant-way-to-display-a-message-when-there-are-no-elements-in-databas/2977478#2977478