parent
71220cd85f
commit
9a1b2b031c
@ -1,2 +1,6 @@
|
||||
class ReviewsController < ApplicationController
|
||||
def index
|
||||
@movie = Movie.find(params[:movie_id])
|
||||
@reviews = @movie.reviews
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,18 @@
|
||||
<h1>Reviews for <%= link_to @movie.title, @movie %></h1>
|
||||
|
||||
<ul class="reviews">
|
||||
<% @reviews.each do |review| %>
|
||||
<li>
|
||||
<%= pluralize(review.stars, 'star') %>
|
||||
<p>
|
||||
<%= review.name %>
|
||||
<span class="date">
|
||||
<%= time_ago_in_words(review.created_at) %> ago
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<%= review.comment %>
|
||||
</p>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
Loading…
Reference in new issue