Add a way to take a detour and return to the previous workflow in Ruby On Rails.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gemfiles
lib
script
test
.gitignore
.project
.travis.yml
Gemfile
History.rdoc Fixed missing ènv`argument to session in pop_detour May 2, 2016
README.md
Rakefile
simple_workflow.gemspec

README.md

simple_workflow

Gem Version Build Status

DESCRIPTION

Extension to Rails to allow simple workflow browser navigation using detours with returns.

FEATURES

  • switch your "link_to" lines to "detour_to" and your controller "redirect_to" to "back_or_redirect_to" to allow users to return from whence they came.

SYNOPSIS:

In views:

detour_to :controller => :my_models, :action => :create
back_or_link_to :controller => :welcome, :action => :index
image_button_to :controller => :my_models, :action => :create

link_to 'Link with custom origin', with_detour(destination_path, origin_path)

In controllers:

back_or_redirect_to :controller => :my_models, :action => :index

In your tests:

def test_valid_login_redirects_as_specified
  add_stored_detour "/bogus/location"
  post :login, :user => { :login => "tesla", :password => "atest" }
  assert_logged_in users(:tesla)
  assert_response :redirect
  assert_redirected_to "http://#{request.host}/bogus/location"
end

REQUIREMENTS

  • Ruby 2.1 or newer. JRuby supported!
  • Rails 4.x

INSTALL

gem install simple_workflow

or in Gemfile

gem 'simple_workflow'

LICENSE

(The MIT License)

Copyright (c) 2009-2016 Uwe Kubosch

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.