Form removing leading zeros for a string


I have a drop down select see below which populates from the below,

select(:record, :visually_similar_to, Sample.find(:all).collect {|p|
p.sample_ref, ] })

sample_ref is varchar field so the values that populate the drop down
are below and they include the leading zeros


When i save this record the field is called visually_similar_to this
removes the leading zeros and leaves it with just the 3 or 4 etc

Why is it removing the leading zeros if its saving to a string field,
how can i stop this. I dont always know how many characters will be in
the field so i couldnt just count the number of characters and then add
the missing zero’s, this shouldnt be neccessary anyway because its a
string field?

Can anyone help?


Sorry for the stupid question, its saving the id and not the sample_ref
field, doh! I need a day off!