I have an HTML Slim document and I would like to know how to put an else statement if no results are found. Here is my current code:
- @books.each do |rep|
.row
.large-12.columns
.bookinfo
.name= book.name
= book.title_name
br
= mail_to author.email, author.email
br
a.phonenumber href="tel:#{ author.phone }"= author.phone
Sorry, I am not at all familiar with HTML Slim and I have very little experience with Ruby. Thanks in advance!
What about something like
- if @books.present?
- @books.each do |rep|
.row
... draw the book
- else
.row No Books Here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With