Method: Sequel::Plugins::WhitelistSecurity::InstanceMethods#update_only
- Defined in:
- lib/sequel/plugins/whitelist_security.rb
#update_only(hash, *only) ⇒ Object
Update the values using the entries in the hash, only if the key is included in only. It may be a better idea to use update_fields instead of this method.
artist.update_only({name: 'Jim'}, :name)
# UPDATE artists SET name = 'Jim' WHERE (id = 1)
artist.update_only({hometown: 'LA'}, :name) # Raise Error
100 101 102 |
# File 'lib/sequel/plugins/whitelist_security.rb', line 100 def update_only(hash, *only) update_restricted(hash, only.flatten) end |