Skip to content

Commit

Permalink
Fix ArgumentError that appears for remote validations for existing da…
Browse files Browse the repository at this point in the history
…tabase options (edit form), i.e. params[:id] specified.
  • Loading branch information
grimen committed Oct 23, 2009
1 parent cd18f81 commit 24381d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion TODO
Expand Up @@ -2,7 +2,8 @@

== Should

* Better validator naming convention: UniquenessValidator => UniquenessOfValidator, etc.
* Fix the validates_uniqueness_of-bugs:
* Make it impossible to submit the form when this validation haven't passed
* Validator API: Custom validators (client-side + remote)
* Form Input Helper API: Custom form helpers (non-"core helper" based)
* Make Rails core validations basic options fully supported
Expand Down
2 changes: 1 addition & 1 deletion lib/validatious-on-rails/controller.rb
Expand Up @@ -34,7 +34,7 @@ def method_missing(action, *args, &block)

if validator_klass.present?
# Perform validation.
if record = ((params[:id].present? && params[:id] > 0) ? record_klass.find(params[:id]) : record_klass.new)
if record = (((params[:id].present? && params[:id].to_i > 0) ? record_klass.find(params[:id]) : record_klass.new) rescue nil)
validation_result = validator_klass.perform_validation(record, params[:attribute].to_sym, params[:value], params)
::ValidatiousOnRails.log "#{validator_klass} validation result: #{validation_result.to_s.upcase}. #{record_klass}##{params[:attribute]} => #{params[:value].inspect}", :info
# validation_result = (validation_result ? 1 : 0)
Expand Down

0 comments on commit 24381d9

Please sign in to comment.