Created
February 4, 2016 09:59
-
-
Save vamsipavanmahesh/da251b34a6aab84548f8 to your computer and use it in GitHub Desktop.
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
I am trying to use wicked gem .. so that I can capture the fields in multiple forms, instead of a single form | |
Here is what I did .. | |
In routes | |
resources :user_steps | |
generated a controller user_steps .. | |
Here is the controller | |
`class UserStepsController < ApplicationController | |
include Wicked::Wizard | |
steps :one, :two, :three | |
def show | |
@user = User.new | |
render_wizard | |
end | |
def update | |
@user = User.new(getparams) | |
render_wizard @user | |
end | |
def getparams | |
params.require(:user).permit(:name, :height, :weight) | |
end | |
end | |
` | |
Created views one, two, theree .. | |
one.html.erb is this | |
`<%= simple_form_for @user, url: wizard_path, :method => :put do |f| %> | |
<%= f.input :name %> | |
<%= f.button "submit" %> | |
<% end %>` | |
Now the model is this | |
rails g model User name weight height | |
The thing is when I go to localhost:3000/user_stpes .. | |
I am able to go from one.html.erb -> two -> three .. but the in the table. Instead of saving in the same id, it is creating | |
id-2 name -(weight) -(height) | |
id-3 - 70(weight) - | |
id- - - 5'5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment