The plaintiff caused an attachment to be issued in this action. On November 10, 1884, the defendant ashed and obtained leave to file an amendment to his answer, and on the next day such amendment was filed, and therein the defendant pleaded as a counter-claim the damages sustained hy him, caused by the wrongful suing out of the attachment. On the thirteenth day of November, 1884, the plaintiff moved the court to substitute J. II. Lansley as plaintiff, on the ground that the plaintiff had assigned the cause of action to Lansley since the commencement of this action. The motion to substitute w.as overruled, and the only question we are required to determine is, did the court err in so doing? It is provided by statute that every action must- be prosecuted in the name of the real party in interest. Code, § 2543. This we understand to mean that actions must be commenced and prosecuted in the name of such party. The statute further provides that “ no action shall abate by the transfer of any interest therein during its pendency.” Code, *482§ 2561. Construing these two sections together, we think, when an action has been commenced, and the plaintiff transfers his action pending the litigation, that it is discretionary with the court whether the assignee shall be substituted as ¡plaintiff; and it has been so held in Chickasaw Co. v. Pitcher, 36 Iowa, 593.
If such substitution can be made without depriving the defendant of a substantial right, it should, and no doubt would, be made. To have made it in this case would have deprived the defendant of such right, because he would be entitled to recover of the plaintiff all the damages he may have sustained; but, as against the assignee, Lansley, his recovery would have been limited to the amount of Lansley’s claim or demand against the defendant.
That this action can be maintained in the name of the plaintiff, although he has transferred his interest to another since the commencement of this action, was held in Jordan v. Ping, 32 Iowa, 64.
Affirmed.