"The polls were ruled invalid"
"Polls" is a noun. Words which describe nouns are called adjectives (red, big, old etc.). Hence in the above sentence, "invalid" is an adjective since it is describing "the polls". "ruled" is a verb as it represents an action (jump, sit, sleep, eat etc.). In this sentence an action is involved in turning "the polls" from a valid to an invalid state. This action is a "ruling" by, for example, a Supreme Court.
The following sentence is easier to understand perhaps:
The walls (noun) were painted (verb) blue (adjective).