The rule says that we can use a possessive adjective or an object pronoun before a gerund. Is there a rule that says when to use each or are they interchangeable? Some say that it's wrong to use an object pronoun before a gerund.
The basic "rule" is that formal written English prefers the possessive in all circumstances, while informal, conversational speech prefers the objective. Generally, the more formal the register, the more likely it is that the possessive will be used. However
Formal English is becoming less rigid. It now tolerates the objective in many circumstances—for instance, a transitive gerund clause which acts as the complement of a matrix verb, as in snailplane's example:
Do you mind me asking a question?
Likewise, the possessive is hardly rare in informal English; it is particularly frequent when the gerund clause is the first constituent in a matrix clause:
My kids KNEW their dad as they had lived with him and me until the separation... but, his leaving like that was tough on them. —from CafeMom, a meeting place for moms.
What seems to govern colloquial use is the syntax; a gerund which plays a particularly ‘un-verbish’ and ‘noun-y’ role is more likely to take the possessive.
So although some dogmatic ‘descriptivists’ claim that the possessive sounds ‘stilted’, in my experience this isn’t true; colloquial English tolerates a wide variety of usages.
Under the circumstances, I would advise you to stick to the possessive, particularly if you are in school or are in a field which demands a lot of formal writing. It’s easier to make a habit of using just one form instead of trying to juggle two; and the possessive will never get you into trouble.