From 93c49a9a52b88adb3ca477ba936cd6099b93c959 Mon Sep 17 00:00:00 2001 From: Vladislav Yashin Date: Thu, 13 Dec 2018 13:25:23 +0400 Subject: [PATCH] Adapt for Redmine 4 --- db/migrate/0001_add_en_name_to_user.rb | 2 +- lib/localizable/user_patch.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/db/migrate/0001_add_en_name_to_user.rb b/db/migrate/0001_add_en_name_to_user.rb index ae48155..054c14c 100644 --- a/db/migrate/0001_add_en_name_to_user.rb +++ b/db/migrate/0001_add_en_name_to_user.rb @@ -1,4 +1,4 @@ -class AddEnNameToUser < ActiveRecord::Migration +class AddEnNameToUser < Rails.version < '5.0' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] def self.up add_column(:users, "name_in_english", :string) diff --git a/lib/localizable/user_patch.rb b/lib/localizable/user_patch.rb index 0d92606..be3ca3c 100644 --- a/lib/localizable/user_patch.rb +++ b/lib/localizable/user_patch.rb @@ -17,7 +17,8 @@ def self.included(base) unloadable # Send unloadable so it will not be unloaded in development. safe_attributes 'name_in_english' - alias_method_chain :name, :localizable + alias_method :name_without_localizable, :name + alias_method :name, :name_with_localizable end end end