OnCollisionEnter problem

Basically, I am making a game where the player has to dodge flying cubes... But I can't seem to get one feature to work. I want to "activate" or "add" a rigidbody to the player when one of the flying cubes hit it, but everything that I have tried has not worked... This is the code that people elsewhere have used:

function OnCollisionEnter(hit : Collision)
{
  if(hit.gameObject.tag == "cube")
  { 
        Debug.Log("Hit");
        gameObject.AddComponent(RigidBody);
  }

}

but this isn't working for me :(

Can anybody help? I don't mind if I'm making a really noobish mistake.

Thanks in advance.

I think I figured it out (the other two answers are absolutely wrong)

You need to remove the capital B in RigidBody to make it Rigidbody. Rigidbody is the function you want to attached, rigidbody is the variable.

Ah, I now know what went wrong. You were all right, so thanks to everyone who posted answers. Basically the problem was a bug (or a complicated feature) in the engine (or my version of the engine)... it only happened when I named my script "collision" (?), and in doing so, I got a strange warning message saying: "This message parameter has to be of type: Collision". It might be just a bug in my downloaded version of Unity (3.2.0), but when I renamed my script to something else, it was fine.

Hi Try

function OnControllerColliderHit(hit: ControllerColliderHit) {
if(hit.gameObject.tag=="cube"){

{ 
        Debug.Log("Hit");

}
}