module ActionView::RecordIdentifier
def dom_class(record_or_class, prefix = nil)
dom_class(post, :edit) # => "edit_post"
If you need to address multiple instances of the same class in the same view, you can prefix the dom_class:
dom_class(Person) # => "person"
dom_class(post) # => "post"
The DOM class convention is to use the singular form of an object or class.
def dom_class(record_or_class, prefix = nil) singular = model_name_from_record_or_class(record_or_class).param_key prefix ? "#{prefix}#{JOIN}#{singular}" : singular end