Skip to content

Instantly share code, notes, and snippets.

@lxcodes
Created June 23, 2011 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lxcodes/1043585 to your computer and use it in GitHub Desktop.
Save lxcodes/1043585 to your computer and use it in GitHub Desktop.
Validation Helper
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>
def field_validation(target, field)
"<span class=\"field-validation-error\">#{target.errors[field][0]}</span>" unless target.errors[field].empty?
end
<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