Checking input

10 views
Skip to first unread message

butsan...@gmail.com

unread,
Jul 6, 2017, 1:54:12 PM7/6/17
to Ruby on Rails: Talk
Hi guys,

I want the user input only integer type. I don't need string or empty input. How do I checking it?
Of course I need cycle, but I don't understand Which expression to set?

Many thanks,
Yuriy

Colin Law

unread,
Jul 6, 2017, 2:54:31 PM7/6/17
to Ruby on Rails: Talk
On 6 July 2017 at 18:54, <butsan...@gmail.com> wrote:
> Hi guys,
>
> I want the user input only integer type. I don't need string or empty input.
> How do I checking it?

This should help
http://guides.rubyonrails.org/active_record_validations.html#numericality

Colin
Reply all
Reply to author
Forward
0 new messages