Closed jvanus closed 6 years ago
The use case I ran into for example:
has_many :items
belongs_to :category
<%= form_for(@category) do |f| %>
...
<%= f.fields_for :items do |item| %>
<div id="<%= item.object.sortable_id %>">
Thank you!
I've made a small modification on Enumerable
for DRY and the case that someone overrides model#sortable_id.
https://github.com/itmammoth/rails_sortable/pull/15/files#diff-2a284cc28e2c46fa796d46ecc87cddceR4
A simple sortable_id method on for classes which include RailsSortable::Model. Returns the same sortable_id as Enumerable#each_with_sortable_id but is useful in cases where that enumeration method is inconvenient.