How to compare name entered in value field with the database?

Asked By 10 points N/A Posted on -

I am facing this problem when I am trying to edit a record. My requirement is simple, as soon as the user enters his or her name I have to check the field user_name and confirm the user that there is no matching name in database if there is no matching database. If it matches, I have to inform him or her the same. I am trying to use contract.exists?params([:user_name]) but it always return false irrespective of the value entered. I am using Ruby on rails for the above. I need simple code to check the database so that I will avoid duplicate entries which is compulsory requirement.


Login/Register to Answer

Related Questions