If the defendant, or other person on his behalf, at any time before judgment, cause an undertaking to be executed to the plaintiff, by one or more sureties, resident in the county, to be approved by the court, in double the amount of the plaintiff's claim as stated in his affidavit, to the effect that the defendant shall perform the judgment of the court, the attachment in such action shall be discharged, and restitution made of any property taken under it or the proceeds thereof. Such undertaking shall, also, discharge the liability of a garnishee in such action, for any property of the defendant in his hands.
R.L. 1910, § 4851.