0

I would like to save an array of strings into a "serialize" field. But I'm afraid that its order will not be kept, when I deserialize it.

I've done some test, and it seems ok. Have you suggestions?

Thanks in advance

P.s. I'm working with Ruby 1.8.7 and rails 2.3.x

Mich Dart
  • 2,294
  • 5
  • 24
  • 43

1 Answers1

0

If it's an array, then yes. Arrays are ordered.

Sets are not (guaranteed) to be ordered. Hashes (keys, values, pairs) are also not (guaranteed) ordered.

Hmm, that hash ordering thing seems to be ruby-version-dependent: Hash ordering preserved between iterations if not modified?

I would always assume unordered hashes, though.

Community
  • 1
  • 1
Satya
  • 4,388
  • 20
  • 29