I have a variable $foo defined in my SCSS/SASS file. I want to be able to also access $foo (as a constant) in my model file, 'bar-model.rb'. How can I do this?
答案 0 :(得分:0)
也许你可以:
<div data-images-per-row="<%= @images_per_row %>"></div>
并通过Javascript 然而,这并没有感觉到&#34;对我来说。也许你正在寻找类似in_groups_of
的东西?
<table>
<% @tasks.in_groups_of(4, false) do |row_tasks| %>
<tr>
<% for task in row_tasks %>
<td><%= image_tag task.image %></td>
<% end %>
</tr>
<% end %>
</table>