I wonder howto get from a string “nil” the nil:NilClass?
nil.inspect -> "nil"
I wish something like:
"nil".to_nil -> nil
Update:
As I write in the comment bellow it’s easier to :
params[:form].each_pair{|k,v| fields[k] = k.to_s.include?('_id') ? v.to_nil : v
then
params[:form].each_pair{|k,v| fields[k] = k.to_s.include?('_id') ? (v == "nil" ? nil : v) : v }
Re-open the string class if you want this functionality globally.