Skip to content

Instantly share code, notes, and snippets.

@tomciopp
Created May 31, 2012 23:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomciopp/2847246 to your computer and use it in GitHub Desktop.
Save tomciopp/2847246 to your computer and use it in GitHub Desktop.
Using devise with wicked for sign up wizards
class RegistrationsController < Devise::RegistrationsController
def create
build_resource
if resource.save
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => after_sign_up_path_for(resource)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
expire_session_data_after_sign_in!
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
respond_with resource
end
end
private
def after_inactive_sign_up_path_for(resource)
user_steps_path
end
end
class UserStepsController < ApplicationController
include Wicked::Wizard
steps :carrier_profile, :shipper_profile, :credit_card
def show
@user = User.last
render_wizard
end
private
def redirect_to_finish_wizard
redirect_to confirm_user_path
end
end
@dankmitchell
Copy link

Any idea how to add validation per step without effecting the initial devise Sign-Up view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment