Method: ActionView::RecordIdentifier#dom_class
- Defined in:
- lib/action_view/record_identifier.rb
#dom_class(record_or_class, prefix = nil) ⇒ Object
The DOM class convention is to use the singular form of an object or class.
dom_class(post) # => "post"
dom_class(Person) # => "person"
If you need to address multiple instances of the same class in the same view, you can prefix the dom_class:
dom_class(post, :edit) # => "edit_post"
dom_class(Person, :edit) # => "edit_person"
78 79 80 81 |
# File 'lib/action_view/record_identifier.rb', line 78 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 |