views:

21

answers:

2

How can I configure username to only have alphabets (a-z, A-Z), numericals (0-9) and underscores (_) and no other characters...

+1  A: 
validates_format_of :username, :with => /^[A-Za-z\d_]+$/

You can change that to be whatever you want, but just using normal rails validations seems appropriate. Above allows digits, A-Z, a-z, and underscores

Jesse Wolgamott
yep... thanks a lot..! I found out that...
Madhusudhan
A: 
Madhusudhan