summaryrefslogtreecommitdiff
path: root/config/initializers/client_side_validations.rb
blob: 252aded72fa55efc11977b463c716d58b8a3e4b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# ClientSideValidations Initializer

# Uncomment to disable uniqueness validator, possible security issue
ClientSideValidations::Config.disabled_validators = [:uniqueness]

# Uncomment the following block if you want each input field to have the validation messages attached.
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
  unless html_tag =~ /^<label/
    %{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
  else
    %{<div class="field_with_errors">#{html_tag}</div>}.html_safe
  end
end