Skip to content

Instantly share code, notes, and snippets.

@RNDcpp
Created January 24, 2020 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RNDcpp/643d24cd4c470e946dcae606daa4f566 to your computer and use it in GitHub Desktop.
Save RNDcpp/643d24cd4c470e946dcae606daa4f566 to your computer and use it in GitHub Desktop.
ids = [1,2,3]
#=> [1, 2, 3]
#書き込み
recommendation = Recommendation.create(uid: 1, recommended_id_list: ids.pack('Q<*'))
#=> #<Recommendation uid: 1, recommended_id_list: "\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00", updated_at: "2020-01-15 09:56:20">
#読み込み
recommendation.recommended_id_list.unpack('Q<*')
#=> [1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment