liam said over 3 years ago on Friend Requests From Scratch :

def contact_request(contact)
		unless self == contact || Connection.where(user: self, contact: contact).exists?
			transaction do
			Connection.create(user: self, contact: contact, status: :pending)
			Connection.create(user: contact, contact: self, status: :requested)
			end
		end
	end

	def accept_request(contact)
		transaction do
			Connection.find_by(user: self, contact: contact, status: [:requested])&.accepted!
			Connection.find_by(user: contact, contact: self, status: [:pending])&.accepted!
		end
	end

Odd that you're able to get it working... would it make any difference that I've created my app with PostgresQL and not SQLite?