sebfie / normalize_numbers

Allow use of comma for Rails model attributes without loosing decimal part

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

NormalizeNumbers

Simple solution for Rails to allow numbers with decimal point to be assigned both with , (comma) and . (dot), without loosing decimal part.

'10,5'.to_f
# 10.0

Installation

Gemfile:

gem 'normalize_rails', git: 'git@github.com:vladra/normalize_numbers.git'

Usage

class Model < ActiveRecord::Base
  normalize_numbers :price, :tax
end

License

The gem is available as open source under the terms of the MIT License.

About

Allow use of comma for Rails model attributes without loosing decimal part

License:MIT License


Languages

Language:Ruby 97.0%Language:Shell 3.0%