Skip to content

Trimmable gem removes leading and trailing white spaces from the AR attribute values.

Notifications You must be signed in to change notification settings

viola/trimmable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trimmable lib removes leading and trailing white spaces from the AR attribute values.

sudo gem install trimmable

Run the following command in your Rails.root:

Rails 2.x
./script/plugin install git@github.com:viola/trimmable.git

Rails 3.x
./script/rails plugin install git@github.com:viola/trimmable.git
class Post < ActiveRecord::Base
  validates_presence_of :title
  trimmable_attributes :title, :comments
end
Started POST "/posts" for 127.0.0.1 at Sun Oct 31 20:30:59 -0400 2010
Processing by PostsController#create as HTML
Parameters: {"commit"=>"Create Post", "post"=>{"comments"=>"    new comment goes here      ", "title"=>"New title    "}, "authenticity_token"=>"Hjd4K8op5TAY7rL4k176tVehIr6eHzuR0vtNIRMlfRU=", "utf8"=>"✓"}
SQL (17.3ms)  INSERT INTO "posts" ("comments", "created_at", "title", "updated_at") VALUES ('new comment goes here', '2010-11-01 00:30:59.163811', 'New title', '2010-11-01 00:30:59.163811')
Redirected to http://localhost:3000/posts/12
Completed 302 Found in 40ms

About

Trimmable gem removes leading and trailing white spaces from the AR attribute values.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages