Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v3.2.13) is shown here.
check_validity(reflection)
private
TODO: These checks should probably be moved into the Reflection, and we
should not be
redefining the options[:join_table] value - instead we should define a
reflection.join_table method.
# File activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb, line 31
def check_validity(reflection)
if reflection.association_foreign_key == reflection.foreign_key
raise ActiveRecord::HasAndBelongsToManyAssociationForeignKeyNeeded.new(reflection)
end
reflection.options[:join_table] ||= join_table_name(
model.send(:undecorated_table_name, model.to_s),
model.send(:undecorated_table_name, reflection.class_name)
)
end