DEV Community

Cover image for Currency Input Masking with Cleave.js and Money gem in Ruby On Rails

Currency Input Masking with Cleave.js and Money gem in Ruby On Rails

Bilal Budhani πŸ‘¨β€πŸ’» on May 21, 2019

Relying on the user's input is a crucial part of building a robust application. That's why I try to apply strong validations on the incoming data o...
Collapse
 
nickjj profile image
Nick Janetakis • Edited

Cleave.js is really really good.

I just started using it over the weekend. Not only does it work for currency formatting but it excels at formatting credit card information too (card number, exp date and security code), and even has callbacks for giving you back the card type based on the first few digits of the card. Perfect for ferrying over that data to Stripe or another gateway.

Collapse
 
ben profile image
Ben Halpern

Neat!

Collapse
 
enzom97 profile image
enzoM97

Hi! How can I create the global js object in an application.html.erb file? I can't figure it out