Created
June 1, 2012 01:56
-
-
Save tomciopp/2848042 to your computer and use it in GitHub Desktop.
Devise with Wicked, after user signs up:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% 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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% 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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
has_one :carrier_profile | |
has_one :shipper_profile | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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