I am rendering a bunch of tables with a graph, all the same type of data repeated a number of times so I wanted to use a partial for DRY code purposes.
This is the code I call in the view:
<%= render 'app_usage', locals: {
metric: "Sessions",
new_total: @flurry_total,
old_total: @flurry_old_total,
growth: flurry_growth,
chart_data: flurry_chart
} %>
and in _app_usage.html.erb
<div class="col-sm-12">
<table class="table table-striped table-condensed">
<tbody>
<tr><td>Metric:</td><td><%= metric %></td></tr>
...
However I get an error for the <tr><td>Metric:</td><td><%= metric %></td></tr> saying the variable metric is undefined. Why is that?