fix inverse_of when find_or_initialize_by_*

inverse_of relation was not being set when calling find_or_initialize_by_ and the entry was
found on the db.
make sure both headers are set before checking for ip spoofing

Conflicts:
	actionpack/lib/action_dispatch/middleware/remote_ip.rb