activescaffold/active_scaffold — Issue #146: Per model list_row_class configuration
Author: clyfe
Created: 2012-03-07 10:46:30+00:00
State: open

I propose I name the helper exactly "list_row_class", and have it always called in view (no more "respond_to?") ?

# view_helpers.rb
def list_row_class(record)
class_override_helper = :"#{clean_class_name(record.class.name)}_list_row_class"
respond_to?(class_override_helper) ? send(class_override_helper, record) : ''
end

# _list_record.html.erb
tr_class = cycle("", "even-record") + ' ' + list_row_class(record)