I have a accepts_nested_attributes_for association between timesheet and timesheetlines. This works great, but when I want to output the timesheetlines, the lines gets ordered on the ID of the timesheetline record. Instead, I want to order the lines on the “daynr” field. How can I achieve this? The code is like this:
<% for timesheetline in timesheet.tms_timesheetlines %>
<%= timesheetline.daynr %>
<%= timesheetline.description %>
<% end %>
Try: