I tried solving this exercise for 2 hours and I just can't find a solution?
Anybody, help please?
http://railsforzombies.org/labs/3/exercises/16
The exercise:
Objective
In the each block, if a Zombie has more than 1 tweet, print out SMART ZOMBIE
Your Database:
Zombies
id name graveyard
1 Ash Glen Haven Memorial Cemetary
2 Bob Chapel Hill Cemetary
3 Jim My Fathers Basement
Tweets
id status zombie_id
1 Where can I get a good bite to eat? 1
2 My left arm is missing, but I don't care 2
3 I just ate some delicious brains 3
4 OMG, my fingers turned green. 1
The view code:
<% zombies = Zombie.all %>
<ul>
<% zombies.each do |zombie| %>
<li>
<%= zombie.name %>
# add if statement here
</li>
<% end %>
</ul>
The code you are looking for is:
<% if zombie.tweets.count > 1 %>
SMART ZOMBIE
<% end %>
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