Displaying 1 result from an estimated 1 matches for "form_sort_performers".
2006 May 16
3
wondering how to do some clever DRYing up
...edit/sort has_many relationships in forms, and consequently on a model with many has_many''s I end up repeating functions to deal with adding, sorting & deleting different types of record.
For instance I have the folllowing basic sorting controller method for a sortable_element:
def form_sort_performers
i = 1
params[:performers].each {
|id|
Performer.update(id, :position => i)
i = i+1
}
render :nothing => true
end
but, I have about 6 things that all need the same basic method (Producers, ImagePersonnel etc...)
is there a way I can somehow move this in...