Method: Tenon::RedirectsController#toggle_active

Defined in:
app/controllers/tenon/redirects_controller.rb

#toggle_activeObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/tenon/redirects_controller.rb', line 7

def toggle_active
  respond_to do |format|
    if @redirect.toggle_active!
      format.json { render json: @redirect.to_json }
      format.html { flash[:notice] = 'redirect approved.' and redirect_to redirects_path }
    else
      format.json { render status: 500, nothing: true }
      format.html { flash[:warning] = 'Error approving redirect.' and redirect_to redirects_path }
    end
  end
end