Repository is archived
No commit activity in last 3 years
No release in over 3 years
A base64 validator for Rails 3 and 4.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
>= 0

Runtime

 Project Readme

activemodel-base64_validator

Build Status Code Climate Coverage Status Dependency Status

Usage

Add to your Gemfile:

gem 'activemodel-base64_validator'

Run:

bundle install

Then add the following to your model:

validates :my_base64_attribute, base64: true

Validation outside a model

If you need to validate a base64 outside a model, you can get the regexp:

Base64Validator::REGEXP
Base64Validator.valid?(string)  # true or false

Credit

Regular Expression based on http://stackoverflow.com/a/475217/1297336