]> git.openstreetmap.org Git - rails.git/blob - app/controllers/preferences/preferences_controller.rb
Revert bogus rubocop correction
[rails.git] / app / controllers / preferences / preferences_controller.rb
1 module Preferences
2   class PreferencesController < ApplicationController
3     layout "site"
4
5     before_action :authorize_web
6     before_action :set_locale
7
8     authorize_resource :class => :preferences
9
10     before_action :check_database_readable
11     before_action :check_database_writable, :only => :update
12
13     def show; end
14
15     def update
16       if update_preferences
17         # Use a partial so that it is rendered during the next page load in the correct language.
18         flash[:notice] = { :partial => "preferences/preferences/update_success_flash" }
19         referer = safe_referer(params[:referer]) if params[:referer]
20         redirect_to referer || { :action => :show }
21       else
22         flash.now[:error] = t "failure", :scope => "preferences.preferences.update"
23         render :show
24       end
25     end
26   end
27 end