I have a yml file of states of the US and Canada. I am loading them
into a State model.
State is defined with a migration
t.column :name, :string
t.column :abbrev :string
In my file states.yml, I have entries of this form
massachusetts:
name: Massachusetts
abbrev: MA
then I have a migration that loads the state information
directory = File.join(File.dirname(FILE), “dev_data”)
Fixtures.create_fixtures(directory, “states”)
Everything works as expected, until I try to load the data for Ontario
the yml entry is
ontario:
name: Ontraio
abbrev: ON
When I run this, the database entry for the Ontario abbreviation
becomes “1”, a string with the character 1
That isn’t what I want. I have managed to work around this by using
the abbreviation ONE, and then taking the first two characters with
slice(0,2) whenever I want an abbreviation.
However, that seems like a band-aid.
ON is perhaps a reserved word, or triggering some behavior I don’t
understand ?
Any help or insight would be appreciated.
I would like Ontario to have the two character abbreviation ON