diff options
-rw-r--r-- | app/models/user.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 5e97459..70c9042 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -107,6 +107,8 @@ class User < ActiveRecord::Base after_save :become_a_member_of_default_user_groups + after_save :change_language_of_child_objects + def destroy clean_whitelist_entries super @@ -246,4 +248,15 @@ class User < ActiveRecord::Base end end + def change_language_of_child_objects + if !self.language_id_changed? + return nil + end + + code = self.language.code + self.sip_accounts.each do |sip_account| + sip_account.update_attributes(:language_code => code) + end + end + end |