Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Rails plugin to allow commas for numeric fields in ActiveRecord models

License

Notifications You must be signed in to change notification settings

dramsay/comma_parser

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CommaParser
===========

This plugin allows you to accept commas from users for integer fields in 
an ActiveRecord model.

Installation
============

For Rails 2.1 and above:

script/plugin install git://github.com/dramsay/comma_parser.git


Example
=======

# Table name: cities
#
#  id           :integer(11)     not null, primary key
#  name         :string(50)
#  population   :integer(11)

class City < ActiveRecord::Base
  allow_commas :population


  # rest of class
end

Now the user can type population "1,000,000" into a form and it will still 
save correctly as "1000000" instead of "1". This saves you the hassle of stripping 
out commas either in JavaScript or in the controller.

Copyright (c) 2008 Doug Ramsay and Intridea, Inc., released under the MIT license

About

Rails plugin to allow commas for numeric fields in ActiveRecord models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.