Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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

Failed to load latest commit information.
lib
script * Renamed project to simple_workflow
test * Fixed wrong reference to the Rails app.
.gitignore * Calculate the current session cookie size using the encryptor to av…
.project * Changed name to simple_workflow
.travis.yml * Fixed bug in use of symbol key for "id" parameter.
Gemfile * Calculate the current session cookie size using the encryptor to av…
History.rdoc
README.md * Left align link to travis-ci.
Rakefile
simple_workflow.gemspec * Added support for String Params. Now requires Rails 4.

README.md

simple_workflow

Build Status

DESCRIPTION:

Extension to Rails to allow detours with returns.

FEATURES/PROBLEMS:

  • 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:

  • Rails

INSTALL:

gem install simple_workflow

or in Gemfile

gem 'simple_workflow'

LICENSE:

(The MIT License)

Copyright (c) 2009-2012 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.

Something went wrong with that request. Please try again.