Changeset 8734
- Timestamp:
- 01/26/08 05:11:09 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/record_identifier.rb
r6951 r8734 54 54 end 55 55 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. 57 57 # If no id is found, prefix with "new_" instead. Examples: 58 58 # 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" 61 61 # 62 62 # If you need to address multiple instances of the same class in the same view, you can prefix the dom_id: 63 63 # 64 # dom_ class(Post.new(:id => 45), :edit) # => "edit_post_45"64 # dom_id(Post.new(:id => 45), :edit) # => "edit_post_45" 65 65 def dom_id(record, prefix = nil) 66 66 prefix ||= 'new' unless record.id