Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8734

Show
Ignore:
Timestamp:
01/26/08 05:11:09 (8 months ago)
Author:
nzkoz
Message:

Correct documentation for dom_id [jbarnette] Closes #10775

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/record_identifier.rb

    r6951 r8734  
    5454    end 
    5555 
    56     # The DOM class convention is to use the singular form of an object or class with the id following an underscore.  
     56    # The DOM id convention is to use the singular form of an object or class with the id following an underscore. 
    5757    # If no id is found, prefix with "new_" instead. Examples: 
    5858    # 
    59     #   dom_class(Post.new(:id => 45)) # => "post_45" 
    60     #   dom_class(Post.new)            # => "new_post" 
     59    #   dom_id(Post.new(:id => 45)) # => "post_45" 
     60    #   dom_id(Post.new)            # => "new_post" 
    6161    # 
    6262    # If you need to address multiple instances of the same class in the same view, you can prefix the dom_id: 
    6363    # 
    64     #   dom_class(Post.new(:id => 45), :edit) # => "edit_post_45" 
     64    #   dom_id(Post.new(:id => 45), :edit) # => "edit_post_45" 
    6565    def dom_id(record, prefix = nil)  
    6666      prefix ||= 'new' unless record.id