-1

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?

1 Answers1

0

Perhaps you could:

  • use data attributes (e.g. <div data-images-per-row="<%= @images_per_row %>"></div> and access it via Javascript

However, this doesn't "feel" right to me. Maybe you are looking for something like 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>
Daniel Olivares
  • 544
  • 4
  • 13