The plaintiff at the time of the issuing of summons, or at any time afterwards may make application to have the property of the defendant attached in accordance with the procedures provided for in this chapter, as security for the satisfaction of any judgment that may be recovered, unless the defendant gives security to pay such judgment as in this chapter provided in the following cases.
1. In an action upon a judgment, or upon contract, express or implied, for the direct payment of money, where the contract is not secured by any mortgage, deed of trust, security interest or lien upon real or personal property; or, if originally so secured, such security has, without any act of the plaintiff, or the person to whom the security was given, become valueless.2. In an action upon a judgment, or upon contract, express or implied, or for the collection of any penalty provided by any statute of this state, against a defendant not residing in this state.[(8-501) C.C.P. 1881, sec. 318; R.S. & R.C., sec. 4302; am. 1913, ch. 51, sec. 1, p. 160; reen. C.L., sec. 4302; C.S., sec. 6779; I.C.A., sec. 6-501; am. 1974, ch. 307, sec. 2, p. 1793.]