-
Notifications
You must be signed in to change notification settings - Fork 28
Home
Olli Huotari edited this page Mar 24, 2018
·
11 revisions
The gem is kept small and simple by choice. See the manual at https://github.com/holli/auto_strip_attributes/ .
This page includes some custom filters that were not included in the gem as options but might otherwise be helpful. See https://github.com/holli/auto_strip_attributes#custom-filters for more info.
AutoStripAttributes::Config.setup do
set_filter :titleize => false do |value|
!value.blank? && value.respond_to?(:titleize) ? value.titleize : value
end
end
Good if you are using Mysql utf8 columns in database instead of utf8mb4
AutoStripAttributes::Config.setup do
set_filter :strip_4_byte_chars => false do |value|
!value.blank? && value.respond_to?(:each_char) ? value.each_char.select{|c| c.bytes.count < 4 }.join('') : value
end
end