I have a remote website that will be sending me some data which I want
to save in one of my models. The problem is that it will also send some
attributes such as attribute_1, attribute_2, etc which I don’t want to
save.
Currently if I do:
my_model.create(params), it will not pass as it has hash keys that don’t
map to any attribute in the model, how to make my model skip these
unknown attributes in a clean manner?
Damn! I was looking for a way to do that, and by default Ruby doesn’t
offer the slice method for hashes, thanks to you I discovered that it is
bundled in ActiveSupport!
Thank you very much for your tip.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.