public Method

RecordIdentifier.dom_class(record_or_class, prefix = nil)

The DOM class convention is to use the singular form of an object or class. Examples:

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"

Source Code

# File action_controller/record_identifier.rb, line 52
def dom_class(record_or_class, prefix = nil)
  [ prefix, singular_class_name(record_or_class) ].compact * '_'
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.