Skip to content

Commit

Permalink
Small doc on index
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Sep 23, 2009
1 parent 5a98b2b commit e044ecf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/mongoid/document.rb
Expand Up @@ -89,6 +89,8 @@ def has_one(association_name)
add_association(:has_one, association_name.to_s.titleize, association_name)
end

# Adds an index on the field specified. Options can be :unique => true or
# :unique => false. It will default to the latter.
def index(name, options = { :unique => false })
collection.create_index(name, options)
end
Expand Down

0 comments on commit e044ecf

Please sign in to comment.