Socket
Book a DemoInstallSign in
Socket

divert

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

divert

0.9
bundlerRubygems
Version published
Maintainers
1
Created
Source

= Divert

This project rocks and uses MIT-LICENSE.

Currently, in order to use: gem 'divert'

Install the migrations with rake divert:install:migrations rake db:migrate

Then add: divert_with :controller_name to the END of your routes file. The route added catches anything so needs to go last.

Finally add: class ApplicationController < ActionController::Base include Divert

rescue_from ActiveRecord::RecordNotFound do |exception|
  divert(request.env['PATH_INFO'])
end

end to your ApplicationController. The rescue_from ActiveRecord::RecordNotFound is optional, but allows Divert to recover from Model.find(...) errors with a redirect or 404.

It will not interfere with actions defined in the configured controller or view files that don't have an action defined. Cos it's nice like that.

By default, Divert will hit the database to find or create a record. To turn off this behaviour, add this following configuration code in your config/initializers/divert.rb : Divert.configure do |config| config.save_to_db = false end

FAQs

Package last updated on 25 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.