module Sequel::Plugins::WhitelistSecurity::ClassMethods

def freeze

Freeze allowed columns when freezing model class.
def freeze
  @allowed_columns.freeze
  super
end

def get_setter_methods

If allowed_columns is set, only allow those columns.
def get_setter_methods
  if allowed_columns
    allowed_columns.map{|x| "#{x}="}
  else
    super
  end
end

def set_allowed_columns(*cols)

Artist.set(name: 'Bob', records_sold: 30000) # Error
Artist.set(name: 'Bob', hometown: 'Sactown') # No Error
Artist.set_allowed_columns(:name, :hometown)

the allowed fields per call.
It may be better to use +set_fields+ which lets you specify

mass assignment, they need to be listed here as well (without the =).
setter methods (methods that end in =) that you want to be used during
any columns not listed here will not be modified. If you have any virtual
Set the columns to allow when using mass assignment (e.g. +set+). Using this means that
def set_allowed_columns(*cols)
  clear_setter_methods_cache
  @allowed_columns = cols
end