module RuboCop::Cop::ActiveRecordHelper

def foreign_key_of(belongs_to)

def foreign_key_of(belongs_to)
  options = belongs_to.last_argument
  return unless options.hash_type?
  options.each_pair.find do |pair|
    next unless pair.key.sym_type? && pair.key.value == :foreign_key
    next unless pair.value.type?(:sym, :str)
    break pair.value.value.to_s
  end
end