Skip to content

Commit

Permalink
Fix db migration
Browse files Browse the repository at this point in the history
  • Loading branch information
v-kolesnikov committed Aug 24, 2015
1 parent 72937ee commit 488b95b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions config/application.rb
Expand Up @@ -37,8 +37,8 @@ class Application < Rails::Application

# The default locale is :en and all translations from
# config/locales/*.rb,yml are auto loaded.
locales_path = Rails.root.join("config", "locales", "**", "*.{rb,yml}").to_s
config.i18n.load_path += Dir[locales_path]
# locales_path = Rails.root.join("config", "locales", "**", "*.{rb,yml}").to_s
# config.i18n.load_path += Dir[locales_path]

config.i18n.available_locales = [:en, :ru]

Expand Down
6 changes: 1 addition & 5 deletions db/migrate/20150822114606_add_locale_to_user.rb
@@ -1,9 +1,5 @@
class AddLocaleToUser < ActiveRecord::Migration
def change
add_column :users, :locale, :string

User.where(locale: nil).update_all(locale: :en)

change_column_null :users, :locale, false
add_column :users, :locale, :string, null: false, default: :en
end
end
8 changes: 4 additions & 4 deletions db/schema.rb
Expand Up @@ -54,13 +54,13 @@
add_index "decks", ["user_id"], name: "index_decks_on_user_id", using: :btree

create_table "users", force: :cascade do |t|
t.string "email", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "email", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "crypted_password"
t.string "salt"
t.integer "default_deck_id"
t.string "locale", null: false
t.string "locale", default: "en", null: false
end

add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
Expand Down

0 comments on commit 488b95b

Please sign in to comment.