Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add some note on adding index to HABTM table

  • Loading branch information...
commit 8ce3ff3ccc10765fe45a2eba3786cb550b4fd20a 1 parent d044069
@sikachu sikachu authored vijaydev committed
Showing with 4 additions and 0 deletions.
  1. +4 −0 activerecord/lib/active_record/associations.rb
View
4 activerecord/lib/active_record/associations.rb
@@ -1428,6 +1428,10 @@ def belongs_to(name, options = {})
# end
# end
#
+ # It's also a good idea to add indexes to each of those columns to speed up the joins process.
+ # However, in MySQL it is advised to add a compound index for both of the columns as MySQL only
+ # uses one index per table during the lookup.
+ #
# Adds the following methods for retrieval and query:
#
# [collection(force_reload = false)]
Please sign in to comment.
Something went wrong with that request. Please try again.