Search code examples
ruby-on-rails-3routesclient-side-validation

ActionController::RoutingError (No route matches [GET] "/uniqueness"):


I am getting an error on uniqueness , I am using client side validation gem

ActionController::RoutingError (No route matches [GET] "/uniqueness"):

Here are the versions which i am using

client_side_validations (3.2.5)
client_side_validations-formtastic (2.2.1)
client_side_validations-simple_form (2.0.0)
simple_form (2.1.0, 2.0.4, 2.0.0, 1.5.2)

I have found this issue on github, It says to use the updated versions of the gem which i am already using. Please let me know how to resolve this issue.The form is created with simple form


Solution

  • Resolved this issue by making changes in the rails.validations.js

    First i have generated the js via

    rails g client_side_validations:copy_assets
    

    On line 550

    changed

    return "//" + window.location.host + "//" + ClientSideValidations.remote_validators_prefix + "/validators/" + validator;
    

    to

    return "//" + window.location.host + ClientSideValidations.remote_validators_prefix + "/validators/" + validator;
    

    Did this because the ajax request was something like this

    http://localhost:3000//validators/uniqueness?case_sensitive=false&user%5Blogin%5D=john&_=1365516039852
    

    You can notice there is two slashes

    http://localhost:3000//