diff options
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/client_side_validations.rb | 14 | ||||
-rw-r--r-- | config/initializers/load_config.rb | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb new file mode 100644 index 0000000..252aded --- /dev/null +++ b/config/initializers/client_side_validations.rb @@ -0,0 +1,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 + diff --git a/config/initializers/load_config.rb b/config/initializers/load_config.rb new file mode 100644 index 0000000..e687429 --- /dev/null +++ b/config/initializers/load_config.rb @@ -0,0 +1 @@ +APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env] |