Reputation: 4152
This is my .erb file;
<% if @comment.reviewer_notes && current_user.type == "User::Reviewer"%>
<% @comment.reviewer_notes.each do |reviewer_note| %>
<?= reviewer_note.rating %> <-- this "works" ie prints out rating on screen
<%= render 'partials/comments/form' %>
this is my .erb partial;
<div class="admin-rating stars clear">
<%= reviewer_note.rating %> <-- this does not work.
</div>
The error I get is;
undefined method `reviewer_rating' for #TipComment:0x007f8b38e29328>
How do I pass in reviewer_note.rating
?
Upvotes: 1
Views: 212
Reputation: 69
<%= render partial: 'reviewer_note_rating', locals: {reviewer_note: reviewer_note} %>
Upvotes: 2
Reputation: 607
You should pass it as a variable to Partial.
<%= render 'partials/comments/form', note_rating: reviewer_note.rating %>
Upvotes: 2