Rails for Zombies Lab 4 > Exercise 3

Rails for Zombies Lab 4 Exercise 3

def create
@zombie = Zombie.create(params[:zombie])
redirect_to @zombie
end

Rails for Zombies Level 4 Exercise 3 (WITH Rails 4 Strong Parameters)

the method zombie_params filters the parameters correctly.

But you're not using that method when you create the Zombie object.

Instead of doing

@zombie = Zombie.create(params[:zombie])

use the method

@zombie = Zombie.create(zombie_params)

Rails for Zombies - Lab 3 › Exercise 4

The code you are looking for is:

<% if zombie.tweets.count > 1 %>
SMART ZOMBIE
<% end %>

rails for zombies lab3 excercise 3, stuck?

Your HTML-Structure is messed up:

<% zombies.each do |zombie|  %>
<li>
<=% zombies.name %>
<% end%>
</li>

should be

<% zombies.each do |zombie|  %>
<li>
<%= zombie.name %>
</li>
<% end %>

Rails for zombies level 5 video: Why wouldn't tweets_path work?

tweets_path won't work here because there isn't a route called 'tweets_path' in his routes.rb file. The only routes that he has (at least that we can see) is the '/all' route, which goes to the tweets controller and index action. If Greg put resources :tweets in his routes.rb file, then tweets_path would work. Also, if you have the code get '/all' => 'tweets#index' (i.e. without as: 'all_tweets'), then all_path will work. With as: 'all_tweets', then only all_tweets_path will work



Related Topics



Leave a reply



Submit