Module: Sequel::Plugins::BlacklistSecurity::InstanceMethods
- Defined in:
- lib/sequel/plugins/blacklist_security.rb
Defined Under Namespace
Classes: ExceptionList
Instance Method Summary collapse
-
#set_except(hash, *except) ⇒ Object
Set all values using the entries in the hash, except for the keys given in except.
-
#update_except(hash, *except) ⇒ Object
Update all values using the entries in the hash, except for the keys given in except.
Instance Method Details
#set_except(hash, *except) ⇒ Object
Set all values using the entries in the hash, except for the keys given in except. You should probably use set_fields
or set_only
instead of this method, as blacklist approaches to security are a bad idea.
artist.set_except({:name=>'Jim'}, :hometown)
artist.name # => 'Jim'
64 65 66 |
# File 'lib/sequel/plugins/blacklist_security.rb', line 64 def set_except(hash, *except) set_restricted(hash, ExceptionList.new(except.flatten)) end |
#update_except(hash, *except) ⇒ Object
Update all values using the entries in the hash, except for the keys given in except. You should probably use update_fields
or update_only
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)
73 74 75 |
# File 'lib/sequel/plugins/blacklist_security.rb', line 73 def update_except(hash, *except) update_restricted(hash, ExceptionList.new(except.flatten)) end |