Created
February 29, 2012 22:59
-
-
Save noniq/1945188 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_inputs | |
self.form.descendants.any_in(:html_tag => ["input", "select", "textarea"]).excludes("html_attributes.type" => "submit").each do |element| | |
attr = "input_" + element.html_attributes["name"] | |
element.errors.add(:attr, " muss ausgefüllt werden") if element[attr].blank? && element["required"] | |
... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment