spree/spree — pull request #2029 by jdutil (2012-09-29 09:30:25+00:00)
Title: Fix preference lookup to use key not deprecated name column.

I ran into an issue upgrading an app from spree 1.1.x to 1.2.x due to preference lookup, and heres a breakdown of what I found.

During the refactoring of preferences by @cmar the name column was deprecated in favor of key, which can be seen in this migration: https://github.com/spree/spree/blob/1-1-stable/core/db/migrate/20120119024710_new_preferences.rb

When my app was upgraded to use the new preferences I had run one of the older versions of the migration that removed the name column and looked like this: https://github.com/spree/spree/blob/8e6222b8cb1f994e6f6bc0d34d5d188a395eff20/core/db/migrate/20111128153359_new_preferences.rb

So I ran into erros during initializing with the name column not existing, which it does not need to since the data does get properly migrated. The database fallback should actually be looking for the key column.

So I've updated the database fallback to properly use the key column, and updated the new spree_one_two migration to no longer add the unused columns.