2

I am making a multi step form in Rails 3.2 , the problem being i get to see the fields generated in the sign-up process but i am unable to update them in the second step . I have looked into Ryan Bates's video but mine is a bit complex . The basic devise fields work fine but those that i added through migrations show nil value . I have defined those fields in attr_accessible in my model as well. Following is my controller code to save the data in second step :-

class Users::AfterSignupController < ApplicationController
  include Wicked::Wizard

  steps :step_1

   def show
    @user = current_user
    render_wizard
  end

  def update
    @user = current_user
    render_wizard
  end

  private

  def redirect_to_finish_wizard
    redirect_to root_url, notice: "Thank you for signing up."
  end


end

Looking forward to helpful suggestions , as the code suggests i have used Wicked gem for the multi step implementation . But if anyone can guide me to do it in normal rails way then i am up for it too . Thanks in advance .

1 Answers1

0

I don't see anywhere where you are saving the user in the update step. As stated in the Wizard documentation if you pass an object to render_wizard it will move to the next wizard step if the object saves or remain at the current step if it fails. So something like this should perform the save

def update
  @user = current_user
  render_wizard @user
end
user3780079
  • 68
  • 1
  • 2