
460 N.W.2d 472 (1990)
STATE of Iowa, Appellee,
v.
Herbert Jerome MABRY, Appellant.
No. 89-1281.
Supreme Court of Iowa.
September 19, 1990.
Stephen J. Rapp, Waterloo, for appellant.
Thomas J. Miller, Atty. Gen., Bruce Kempkes, Sarah J. Coats, Asst. Attys. Gen., and James Metcalf, County Atty., for appellee.
Considered by LARSON, P.J., and CARTER, LAVORATO, NEUMAN, and ANDREASEN, JJ.
LAVORATO, Justice.
In this appeal the question is whether an amendment to a criminal statute was passed in violation of article III, section 29 of the Iowa Constitution. This constitutional provision requires that all legislative acts deal with only one subject. We do not decide this constitutional question because the amendment was incorporated into the *473 Iowa Code long before the present challenge. In these circumstances the alleged constitutional defect was cured at the time the amendment was incorporated into the Code. We therefore affirm.
On April 19, 1988, Herbert Mabrythe defendantsold one-eighth of an ounce of cocaine to an Iowa Highway Patrol trooper. The trooper was working as an undercover agent at the time. Mabry was subsequently arrested and charged with possession of a controlled substance with intent to deliver. See Iowa Code § 204.401(1)(a) (1987).
Mabry pleaded not guilty and waived his right to a jury trial. Mabry asserted two defenses to the charge. First, Mabry claimed that the trooper's actions and his consistent pestering of Mabry for the drugs constituted entrapment. Second, Mabry alleged that an amendment to section 204.410 was enacted in violation of article III, section 29 of the Iowa Constitution. This second defense is the sole basis of this appeal.
Iowa Code section 204.410 addresses the applicability of an accommodation offense to crimes involving illegal drug sales. Simply put, an accommodation offense occurs if the State fails to prove that the defendant intended to or did make a profit from the illegal drug transaction. An accommodation offense carries a less severe penalty than an offense for possession with intent to deliver. See Iowa Code §§ 204.410, 204.401(1)(a).
Before 1980 the accommodation offense applied to all controlled substances, including cocaine. See Iowa Code §§ 204.410, 204.401(3) (1979). In 1980 the legislature amended section 204.410 and limited the accommodation offense to only those drug transactions involving marijuana sales. This limitation was added as a floor amendment in the House of Representatives to Senate File 2070, Acts of the 68th General Assembly.
Before and during trial Mabry argued that Senate File 2070 violated the single-subject requirement of article III, section 29 of the Iowa Constitution. According to Mabry this made the amendment void, leaving the accommodation law in existence before 1980 applicable to him.
At trial Mabry admitted he sold the cocaine to the trooper. Mabry, however, denied being a drug dealer. Mabry stated he only bought the cocaine for the trooper so that the trooper would stop pestering him. According to Mabry, heMabrypaid $200 for the cocaine and sold it to the trooper for the same amount. The trooper testified Mabry approached him about buying the cocaine and told the trooper to call Mabry anytime the trooper needed more.
On January 3, 1989, following a bench trial, the district court found that Mabry was guilty as charged. Although the court found that Mabry was not entrapped, it ruled that the State failed to prove that Mabry made a profit or intended to make a profit from the sale. The court rejected Mabry's single-subject argument regarding the constitutionality of Senate File 2070. The court then sentenced Mabry to an indeterminate term of ten years. See Iowa Code §§ 204.401(1)(a), 902.9(3).
Most state constitutions require that "no [legislative] act shall contain more than one subject, which shall be expressed in its title...." 1A Sutherland, Statutory Construction § 22.08, at 187 (1985). This constitutional mandate is known as the "single-subject" rule.
The purpose of the single-subject rule is three-fold. Note, Before a Bill Becomes a LawConstitutional Form, 8 Drake L.Rev. 66, 67 (1958) [hereinafter Constitutional Form]. First, it prevents logrolling. Id. Logrolling occurs when unfavorable legislation rides in with more favorable legislation. Id. Second, it facilitates the legislative process by preventing surprise when legislators are not informed. Id. Finally, it keeps the citizens of the state fairly informed of the subjects the legislature is considering. Id.
Article III, section 29 of the Iowa Constitution states:
Every act shall embrace but one subject, and matters properly connected therewith; which subject shall be expressed in the title. But if any subject shall be *474 embraced in an act which shall not be expressed in the title, such act shall be void only as to so much thereof as shall not be expressed in the title.
This provision has four requirements. First, the act may have only one subject together with matters germane to it. Western Int'l v. Kirkpatrick, 396 N.W.2d 359, 364 (Iowa 1986). Second, the title of the act must contain the subject matter of the act. Id. at 365. Third, any subject not mentioned in the title is invalid. See Constitutional Form, 8 Drake L.Rev. at 67. Last, an invalid subject in the act does not invalidate the remaining portions that are expressed in the title. Id.
There are longstanding rules for determining whether an act meets the constitutional mandate of article III, section 29. First and foremost, we construe "the [act] liberally in favor of its constitutionality." State v. Iowa Dist. Court, 410 N.W.2d 684, 686 (Iowa 1987). Before we can say the act is invalid we must find that the act "encompass[es] two or more dissimilar or discordant subjects that have no reasonable connection or relation to each other." Id.; see also Western Int'l, 396 N.W.2d at 364. Even if the "matters grouped as a single subject might more reasonably be classified as separate subjects, no violation occurs if these matters are nonetheless relevant to some single more broadly stated subject." Id.
So to pass constitutional muster the matters contained in the act must be germane. To be germane, "all matters treated [within the act] should fall under some one general idea and be so connected with or related to each other, either logically or in popular understanding, as to be part of ... one general subject." Long v. Board of Supervisors, 258 Iowa 1278, 1283, 142 N.W.2d 378, 381 (1966).
In addition to these rules, we use a "fairly debatable test" to determine whether the enactment of a statute complies with the constitution. Under this test "[l]egislation will not be held unconstitutional unless clearly, plainly and palpably so." Long, 258 Iowa at 1283, 142 N.W.2d at 381. And "[i]f the constitutionality of an act is merely doubtful or fairly debatable, the courts will not interfere." Id., see also Burlington & Summit Apartments v. Manolato, 233 Iowa 15, 17, 7 N.W.2d 26, 28 (1942). So "[i]t is only in extreme cases, where unconstitutionality appears beyond a reasonable doubt, that this court can or should act...." Long, 258 Iowa at 1284, 142 N.W.2d at 381-82.
In considering Senate File 2070, the district court wrote that
[t]he act in question deals with the licensing of physicians, pharmacists and other health practitioners. It incorporates with it a provision that maintains in certain of these practitioners the right to dispense by a prescription controlled substances. It further changes the statutory definition of accommodation as the same relates to possession with intent to deliver controlled substances. There appears to be a chain-type linkage between them.
The court then applied the fairly debatable test to this amendment and asked:
Is it doubtful that Senate File 2070 ... is constitutional under the one subject rule? Yes. Is it fairly debatable as to whether or not the act is constitutional under the one subject rule? Yes. Is it clearly, plainly or palpably unconstitutional beyond a reasonable doubt? No.
Under this test, the district court held that the amendment was passed within the constitutional requirements.
On appeal, Mabry argues that the district court used the wrong analysis. He claims that the proper analysis for article III, section 29 violations is to "search for (or to eliminate the presence of) a single purpose toward which the several dissimilar parts of the bill relate." Miller v. Bair, 444 N.W.2d 487, 490 (Iowa 1989). Mabry contends that here there is no single purpose to Senate File 2070 that brings the dissimilar parts into one general grouping. For that reason he contends the language limiting the accommodation provision to marijuana is void because it was enacted contrary to article III, section 29 of the Iowa Constitution.
*475 For reasons that follow, we need not decide the constitutional issue.
As we mentioned earlier most states have constitutional provisions like article III, section 29 of the Iowa Constitution. In a number of these states, courts have held that codification of the challenged legislation cures a constitutional defect in title or subject matter. See, e.g., State ex rel. Sossaman v. Stone, 235 Ala. 233, 236, 178 So. 18, 21 (1937); Specht v. People, 156 Colo. 12, 15, 396 P.2d 838, 840 (1964); Warnock v. Florida Hotel & Restaurant Comm'n, 178 So.2d 917, 919 (Fla.App. 1965); Heaton v. State, 60 Ga.App. 428, 429, 4 S.E.2d 98, 99 (1939); Federal Reserve Bank v. Citizens Bank & Trust Co., 53 Idaho 316, 326-27, 23 P.2d 735, 738-39 (1933); Bond v. Board of County Comm'rs, 178 Kan. 668, 670, 290 P.2d 1013, 1015 (1955); Falender v. Hankins, 296 Ky. 396, 399, 177 S.W.2d 382, 383-84 (1944); Grillo v. State, 209 Md. 154, 158, 120 A.2d 384, 387 (1956); State v. Rice, 134 Mont. 265, 268, 329 P.2d 451, 453 (1958); Peterson v. Vasak, 162 Neb. 498, 502, 76 N.W.2d 420, 424 (1956); Abruzzese v. Oestrich, 138 N.J.Eq. 33, 41, 47 A.2d 883, 889 (Ch.1946); Lapland v. Stearns, 79 N.D. 62, 67, 54 N.W.2d 748, 752 (1952); Atlas Life Ins. Co. v. Rose, 196 Okla. 592, 595, 166 P.2d 1011, 1014 (1946); South Carolina Tax Comm'n v. York Electric Coop., Inc., 275 S.C. 326, 331, 270 S.E.2d 626, 628-29 (1980); State v. Barr, 89 S.D. 280, 282, 232 N.W.2d 257, 259 (1975); International Harvester Co. v. Carr, 225 Tenn. 244, 260, 466 S.W.2d 207, 214 (1971); Skaggs v. Grisham-Hunter Corp., 53 S.W.2d 687, 688 (Tex.Civ.App.1932); State v. Chesapeake & Potomac Tel. Co., 121 W.Va. 420, 421, 4 S.E.2d 257, 258 (1939); State v. Pitet, 69 Wyo. 478, 498, 243 P.2d 177, 186 (1952).
The rule is stated this way:
Although an act, as originally passed, was unconstitutional because it contained matter different from that expressed in its title, or referred to more than one subject, it becomes, if otherwise constitutional, valid law on its adoption by the legislature and incorporation into a general revision or code....
82 C.J.S. Statutes § 274, at 459 (1953 & Supp.1990).
We think the rule is fair to all concerned, and we adopt it. The rule strikes a balance between the salutary purposes of the single-subject rule and the importance of upholding the constitutionality of new legislation.
Iowa Code section 14.15 governs codification of new legislation in this state. This section provides in part:
A new Code or its supplements shall be issued as soon as possible after the final adjournment of the second regular session of the general assembly.
Section 14.15 provides a window of time measured from the date legislation is passed until such legislation is codified. During this window of time, the legislation may be challenged as violative of article III, section 29 of the Iowa Constitution. Absent a successful challenge during this period of time, the new legislation, if it is otherwise constitutional, becomes valid law. This is so even though the way the new legislation was passed may have violated article III, section 29 of the Iowa Constitution. And an article III, section 29 challenge is barred even though future litigants may claim they were in no position to make such a challenge before the codification.
Senate File 2070 was enacted and signed by the governor in 1980. This legislation first appeared in the 1981 Code and has appeared in all of the codes since then. No one had lodged a successful article III, section 29 challenge to the legislation before the 1981 Code was issued. So any alleged constitutional defect Mabry raises was cured long before Mabry's challenge which is now barred. For that reason we affirm the judgment of the district court.
AFFIRMED.
