public
Description: Rails plugin to allow commas for numeric fields in ActiveRecord models
Homepage:
Clone URL: git://github.com/dramsay/comma_parser.git
name age message
file .gitignore Mon Oct 06 13:17:08 -0700 2008 Forcing Rails to recognize that attribute has b... [Doug Ramsay]
file MIT-LICENSE Mon Oct 06 08:30:02 -0700 2008 Committing first version of plugin [Doug Ramsay]
file README Tue Oct 14 10:25:31 -0700 2008 Adding installation instructions to README [Doug Ramsay]
file Rakefile Mon Oct 06 08:30:02 -0700 2008 Committing first version of plugin [Doug Ramsay]
file init.rb Mon Oct 06 08:30:02 -0700 2008 Committing first version of plugin [Doug Ramsay]
directory lib/ Mon Oct 06 13:42:35 -0700 2008 Doing this in a simpler and better way [Doug Ramsay]
directory test/ Mon Oct 06 13:17:08 -0700 2008 Forcing Rails to recognize that attribute has b... [Doug Ramsay]
README
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