0.0
No commit activity in last 3 years
No release in over 3 years
TrimSpacesFor gem 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
 Dependencies

Development

Runtime

>= 3.1.0
 Project Readme

TrimSpacesFor

TrimSpacesFor gem removes leading and trailing white spaces from the AR attribute values. That corresponds to the full-width space.

Installing

gem install trim_spaces_for

Usage

class Article < ActiveRecord::Base
  trim_spaces_for :title
end

> obj = Article.new
> obj.title = "  Article Title  "
> obj.save  #=> true
> obj.title  #=> "Article Title"

class User < ActiveRecord::Base
  trim_spaces_for :age
  validates :age, :numericality => {:only_integer => true}
end

> obj = User.new
> obj.age = " 23" # full-width space
> obj.save  #=> true
> obj.age #=> 23

This project rocks and uses MIT-LICENSE.