Rails 4 migration includes duplicate index creation

Rails 4 adds an index automatically for a references attribute, so only add the explicit index creation statements when the ActiveRecord version is less than 4.