Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Show flash message in the correct locale after updating the Typus.use…

…r_class.
  • Loading branch information...
commit ab800cc6fcb2eb47939c0db6cbcdcc9bedc74194 1 parent 6fd42e3
Francesc Esplugas authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 app/controllers/admin/master_controller.rb
View
9 app/controllers/admin/master_controller.rb
@@ -146,12 +146,19 @@ def update
@item.update_attributes Typus.user_fk => @current_user.id
end
- flash[:success] = _("{{model}} successfully updated.", :model => @resource[:human_name])
path = if @resource[:class].typus_options_for(:index_after_save)
params[:back_to] ? "#{params[:back_to]}##{@resource[:self]}" : { :action => 'index' }
else
{ :action => @resource[:class].typus_options_for(:default_action_on_item), :id => @item.id, :back_to => params[:back_to] }
end
+
+ # Reload @current_user when updating to see flash message in the
+ # correct locale.
+ if @resource[:class].eql?(Typus.user_class)
+ I18n.locale = @current_user.reload.preferences[:locale]
+ end
+
+ flash[:success] = _("{{model}} successfully updated.", :model => @resource[:human_name])
redirect_to path
else
Please sign in to comment.
Something went wrong with that request. Please try again.