Project

trimmable

0.0
No commit activity in last 3 years
No release in over 3 years
Trimmable removes leading and trailing white spaces from the AR attribute values.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Trimmable¶ ↑

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

Installing¶ ↑

Trimmable gem¶ ↑

sudo gem install trimmable

Trimmable plugin¶ ↑

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

Usage¶ ↑

Model¶ ↑

class Post < ActiveRecord::Base
  validates_presence_of :title
  trimmable_attributes :title, :comments
end

Log output: ¶ ↑

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