client_side_validations 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,21 +8,20 @@ if (typeof(jQuery) != "undefined") {
8
8
  clientSideValidations: function() {
9
9
  var form = this;
10
10
  var object = form.attr('object-csv');
11
- var id = form[0].id;
11
+ var form_id = form[0].id;
12
12
  var object_id = null;
13
13
  var adapter = 'jquery.validate';
14
- if (/new/.test(id)) {
15
- id = /new_(\w+)/.exec(id)[1]
16
- } else if (/edit/.test(id)) {
17
- id = /edit_(\w+)_\d+/.exec(id)[1]
18
- object_id = /edit_\w+_(\d+)/.exec(id)[1]
14
+
15
+ if (/edit/.test(form_id)) {
16
+ object_id = /edit_\w+_(\d+)/.exec(form_id)[1];
19
17
  }
18
+
20
19
  if (eval("typeof(" + object + "_validation_options)") != "undefined") {
21
20
  var options = eval(object + '_validation_options');
22
21
  } else {
23
22
  var options = { }
24
23
  }
25
- var client = new ClientSideValidations(id, adapter, object_id)
24
+ var client = new ClientSideValidations(object, adapter, object_id)
26
25
  var rules = eval(object + '_validation_rules');
27
26
  var validations = client.adaptValidations(rules);
28
27
  options['rules'] = validations.rules;
@@ -44,7 +44,7 @@ module DNCLabs
44
44
  private
45
45
 
46
46
  def can_validate?(validation)
47
- if on = validation.options.delete(:on)
47
+ if on = validation.options[:on]
48
48
  on = on.to_sym
49
49
  (on == :save) ||
50
50
  (on == :create && base.new_record?) ||
@@ -44,7 +44,7 @@ module DNCLabs
44
44
  private
45
45
 
46
46
  def can_validate?(validation)
47
- if on = validation.options.delete(:on)
47
+ if on = validation.options[:on]
48
48
  on = on.to_sym
49
49
  (on == :save) ||
50
50
  (on == :create && base.new_record?) ||
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 4
8
- - 0
9
- version: 2.4.0
8
+ - 1
9
+ version: 2.4.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Cardarella
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-10 00:00:00 -04:00
17
+ date: 2010-07-11 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency