Skip to content

Instantly share code, notes, and snippets.

@simeonwillbanks
Created June 8, 2012 17:31
Show Gist options
  • Save simeonwillbanks/2897084 to your computer and use it in GitHub Desktop.
Save simeonwillbanks/2897084 to your computer and use it in GitHub Desktop.
Mixin Idea To Force UTF-8 #rails #ActiveRecord #utf8 #mixin
module Utf8able
extend ActiveSupport::Concern
included do
before_save do
# introspect attributes
# filter on text like
# force_utf8
end
end
end
# Usage
# class Foo < ActiveRecord::Base
# include Utf8able
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment