However, if you are a freelancer and therefore they are effectively your customer... they don't own the rights to the code unless its explicitly signed over in the contract.
Yes, I think it really depends on how a freelancer is viewed - a temporary employee, or an external agent?
Also, I know that in scotland word of mouth, emails etc are legally binding. However, I guess contracts would make things more sure.
I do not know about the law in Scotland, but contracts can be formed by word of mouth or emails, so you can settle the question of code ownership even just verbally. Of course, having a printed and signed document is far better than having to prove that what was said really was said or that the email was not forged.
I just think I would find it a bit strange asking a company to sign a contract since nobody has asked one from me. I wouldn't know how to word it without it sounding like, I don't trust/believe you. It seems that so many people work on trust.
I see what you mean. Still, I guess it is better safe than sorry for a big or even moderately sized project. Besides, on such a project you might ask for partial payment after some milestone has been reached, so having a written contract that includes a concrete requirements specification would be clearer for everyone.
Basically, put it down in writing what is the scope of the work, what is the fee and when should it be paid, and who owns the work (or parts of it, e.g., a library may be under your copyright and non-exclusively licensed to the client, but the client owns the copyright to the more client specific parts).
Disclaimer: I am not a lawyer, this is not legal advice.