Class: Tenon::RedirectsController

Inherits:
ResourcesController show all
Defined in:
app/controllers/tenon/redirects_controller.rb

Instance Method Summary collapse

Methods inherited from ResourcesController

#create, #destroy, #edit, #index, #initialize, #new, #reorder, #update

Constructor Details

This class inherits a constructor from Tenon::ResourcesController

Instance Method Details

#resource_paramsObject



3
4
5
# File 'app/controllers/tenon/redirects_controller.rb', line 3

def resource_params
  params.require(:redirect).permit!
end

#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