Skip to content

Commit

Permalink
Fix chenge user locale (#508)
Browse files Browse the repository at this point in the history
* update ruby v

* fix-locale-in-resume
  • Loading branch information
usernaimandrey committed Apr 7, 2023
1 parent 274bac8 commit 5f11d49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/web/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def github
I18n.locale = session[:locale] || I18n.default_locale

if @user.persisted?
@user.locale = I18n.locale
@user.save!
sign_in_and_redirect @user
set_flash_message(:notice, :success, kind: 'Github') if is_navigational_format?
else
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20230407122355_setup_locale.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class SetupLocale < ActiveRecord::Migration[7.0]
def change
# rubocop:todo Rails/SkipsModelValidations
User.update_all(locale: :ru)
# rubocop:enable Rails/SkipsModelValidations
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_03_30_213157) do
ActiveRecord::Schema[7.0].define(version: 2023_04_07_122355) do
create_table "countries", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
Expand Down

0 comments on commit 5f11d49

Please sign in to comment.