A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mkcode/peek-alt-routes below:

mkcode/peek-alt-routes: Easily toggle alternate controllers and routes with peek.

Easily toggle alternate controllers and routes.

Things this peek view provides:

Add this line to your application's Gemfile:

And then execute:

Or install it yourself as:

$ gem install peek-alt-routes

Add the following to your config/initializers/peek.rb:

Peek.into Peek::Views::AltRoutes

You may provide a name option to the Peek view to set the button display text:

Peek.into Peek::Views::AltRoutes, name: 'Site Redesign'

Add the following to your app/assets/javascripts/application.js:

//= require peek/views/alt_routes

Add the following to your app/assets/javascripts/application.css:

/*
 *= require peek/views/alt_routes
 */

Use the peek_alt_routes? route constraint as you see fit. In config/routes.rb:

  # Remember that Rails matches the first route it finds (top to bottom) so
  # be sure to put any constrained routes before the open routes.

  # Route group example:
  constraints peek_alt_routes?: true do
    get '/about', to: 'next_site#about'
    get '/contact', to: 'next_site#contact'
  end
  get '/about', to: 'site#about'
  get '/contact', to: 'site#contact'

  # Single case example:
  get 'new-site-only' to: 'new_site#only', constraints: { peek_alt_routes?: true }

  # DRY routes using routing concerns ( >= Rails 4.0 ) example:
  concern :static_pages do
    get '/about, action: 'about'
    get '/contact, action: 'contact'
  end
  scope controller: 'next_site', constraints: { peek_alt_routes?: true } do
    concerns :static_pages
    get '/help', action: 'help'
  end
  scope controller: 'site' do
    concerns :static_pages
  end
When to use this vs Flipper
  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4