Created
June 23, 2011 20:45
-
-
Save lxcodes/1043585 to your computer and use it in GitHub Desktop.
Validation Helper
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
ArgumentError at /faca-sua-insricao | |
invalid byte sequence in US-ASCII | |
file: utils.rb location: gsub line: 153 | |
sinatra.error | |
#<NoMethodError: undefined method `errors' for nil:NilClass> |
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 field_validation(target, field) | |
"<span class=\"field-validation-error\">#{target.errors[field][0]}</span>" unless target.errors[field].empty? | |
end | |
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
<td><%= field_validation(@u, :first_name) %><input type="text" name="first_name" value="<%= session[:user].first_name %>" id="first_name" class="validate[required]"><br /><label for="first_name"><%= t[:forms][:firstName] %></label></td> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment