module Sequel::Plugins::BlacklistSecurity::InstanceMethods
Public Instance Methods
set_except(hash, *except)
click to toggle source
Set all values using the entries in the hash, except for the keys given in except. You should probably use set_fields
instead of this method, as blacklist approaches to security are a bad idea.
artist.set_except({name: 'Jim'}, :hometown) artist.name # => 'Jim'
# File lib/sequel/plugins/blacklist_security.rb 76 def set_except(hash, *except) 77 set_restricted(hash, ExceptionList.new(except.flatten)) 78 end
update_except(hash, *except)
click to toggle source
Update all values using the entries in the hash, except for the keys given in except. You should probably use update_fields
instead of this method, as blacklist approaches to security are a bad idea.
artist.update_except({name: 'Jim'}, :hometown) # UPDATE artists SET name = 'Jim' WHERE (id = 1)
# File lib/sequel/plugins/blacklist_security.rb 85 def update_except(hash, *except) 86 update_restricted(hash, ExceptionList.new(except.flatten)) 87 end
Private Instance Methods
setter_methods(type)
click to toggle source
If set_except
or update_except
was used, remove the related methods from the list.
Calls superclass method
# File lib/sequel/plugins/blacklist_security.rb 92 def setter_methods(type) 93 if type.is_a?(ExceptionList) 94 meths = super(:all) 95 meths -= Array(primary_key).map{|x| "#{x}="} if primary_key && model.restrict_primary_key? 96 meths -= type.map{|x| "#{x}="} 97 meths 98 else 99 super 100 end 101 end