No commit activity in last 3 years
No release in over 3 years
a small ActiveRecord plugin that removes common HTML entities from attributes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Replace Entities¶ ↑

If you import data from confused sources you may end up with HTMLish entites littering your model data. I’m looking at you ®

If you don’t want them, then replace them with the appropriate UTF-8 character before they make it into your database.

Examples¶ ↑

class Product < ActiveRecord::Base
  replace_entities!
end

class Product < ActiveRecord::Base
  replace_entities!, :except => :title
end

class Product < ActiveRecord::Base
  replace_entities!, :only => :description
end

Installation¶ ↑

  1. On rails 2.3

* gem install strip_control_chars
* add the following to your environment.rb

  config.gem 'replace_entities', version => "<2.0"
  1. On rails 3

* gem install strip_control_chars
* add the following to your Gemfile

  gem 'replace_entities', ">=2.0"

Compatibility¶ ↑

On rails 2.x you must use version 1.x of this gem. On rails 3.x you must use version 2.x of this gem.

Caveats¶ ↑

The entities are replaced with UTF-8 characters. If you’re not expecting UTF-8 data, you may end up with invalid strings.

Credits¶ ↑

This plugin is essentially a fork of the strip attributes plugin, released under the MIT License by Ryan McGeary.

github.com/rmm5t/strip_attributes

License¶ ↑

Copyright © 2007-2008 Ryan McGeary released under the MIT license Copyright © 2010 James Healy released under the MIT license

en.wikipedia.org/wiki/MIT_License