Fix call to deprecated function 'local_const_defined?' in associations.rb