erb 中的 partial 可选参数
Optional Parameters in View Partials
# _tags.html.erb
<% if tags.any? %>
<div class="is-tags">
<strong>标签: </strong>
<% tags[0..(limit ||= 5)].each do |tag| %>
<span class="badge bg-dark"><%= tag.name %></span>
<% end %>
</div>
<% end %>
# index.html.erb
<%= render partial: "shared/tags", locals: { tags: post.tags } %>