Displaying 1 result from an estimated 1 matches for "imagepersonnel".
2006 May 16
3
wondering how to do some clever DRYing up
...oller 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 into the application controller and run it generically such that it takes a Model as an argument, something like:
def form_sort(model)
i = 1
params[:#{model}].each { # would need to pluralise
|id|
#{model}.update(id, :position =&...