Closed alaibe closed 8 years ago
Ruby
user.attributes.delete_if { |k, v| v.nil? }
Rails
user.attributes.compact
Thx for your answer.
Unfortunately it is not enough
=> you can't set a value to nil
with this solution
I already have a workaround to make it works (I can post it if you want)
My question is more: The README is not sync with the behaviour so if
It'd take some effort to add tracking of which attributes have been set to nil and which have not been set. So I'm going to fix the README to match the behavior.
Hi This is the readme:
This is from my irb
Virtus version: 1.0.5 Ruby version: ruby 2.2.2p95
I would expect
attributes
to not return the birthday As I am using virtus for form object it causes me problem when I want to do PATCH request