It would be good to don't strip on binary columns (@sql_type="mediumblob", @type=:binary). I had the callback added to ApplicationRecord, and had "invalid byte sequence in UTF-8" error on a binary column. I think strip_record could check the column.
Also, supporting a symbol for except or only to be a method name, or supporting proc, could be used to call strip_attributes in ApplicationRecord, and then define a method with the excluded columns:
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
strip_attributes allow_empty: true, except: :not_stripped_columns
end
class Picture < ApplicationRecord
def not_strippped_columns
[:picture]
end
end
Or with proc:
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
strip_attributes allow_empty: true, except: proc { |record| record.not_stripped_columns }
end
It would be good to don't strip on binary columns (@sql_type="mediumblob", @type=:binary). I had the callback added to ApplicationRecord, and had "invalid byte sequence in UTF-8" error on a binary column. I think strip_record could check the column.
Also, supporting a symbol for except or only to be a method name, or supporting proc, could be used to call strip_attributes in ApplicationRecord, and then define a method with the excluded columns:
Or with proc: