validates_format_of in rails (only numbers, commas and white spaces)
<p>I have a field "floors" and I want it to accept only numbers, commas and white spaces. </p>

<p>I'm using a <code>validates_format_of :floors, :with =&gt; /[0-9\,\s]+/</code> right now, but it works bad because it accepts a string like "1, 2, abc". </p>

<p>Please help me to find my mistake.</p>