Complete Lesson 5

main
Simon Quigley 1 year ago
parent 77465c4ab0
commit 94f206d991

@ -1,6 +1,6 @@
class MoviesController < ApplicationController class MoviesController < ApplicationController
def index def index
@choices, @movies = ["Iron Man ⎊", "Batman 🦇", "Forrest Gump 🏃"], [] @choices, @movies = Movie.all, []
(0..15).each{ |num| (0..15).each{ |num|
@movies.append(@choices.sample()) @movies.append(@choices.sample())
} }

@ -5,7 +5,7 @@
<ul> <ul>
<% @movies.each do |movie| %> <% @movies.each do |movie| %>
<li><%= movie %></li> <li><%= movie.title %> (<%= movie.rating %>): <%= number_to_currency(movie.total_gross, precision: 0) %></li>
<% end %> <% end %>
</ul> </ul>
</div> </div>

Loading…
Cancel
Save