Skip to content

Instantly share code, notes, and snippets.

@tomciopp
Created June 1, 2012 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomciopp/2848042 to your computer and use it in GitHub Desktop.
Save tomciopp/2848042 to your computer and use it in GitHub Desktop.
Devise with Wicked, after user signs up:
<% form_for ??? , url: wizard_path, method: :get do |f| %>
<div>
<%= f.label :dot, "Please enter your DOT Number:" %>
<%= f.text_field :dot %>
</div>
<%= f.submit "Next Step", class: "btn btn-primary" %>
<% end %>
When a user signs up they are directed to a page that asks them to enter in their profile info
if they are a shipper or a carrier. I am unsure what to put in the new and create actions of the user_steps controller since I am creating two separate objects for the same controller. The actions for creating both of these objects should be exactly the same.
<% form_for ??? , url: wizard_path, method: :get do |f| %>
<div>
<%= f.label :company_name, "What is your company name?" %>
<%= f.text_field :company_name %>
</div>
<%= f.submit "Next Step", class: "btn btn-primary" %>
<% end %>
class User < ActiveRecord::Base
has_one :carrier_profile
has_one :shipper_profile
end
class UserStepsController < ApplicationController
include Wicked::Wizard
steps :carrier_profile, :shipper_profile, :credit_card
def new
???
end
def create
???
end
def show
@user = User.last
case step
when :carrier_profile
skip_step if @user.shipper?
when :shipper_profile
skip_step if @user.carrier?
end
render_wizard
end
private
def redirect_to_finish_wizard
redirect_to confirm_user_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment