1

When a user signs up, they begin creating their Finances profile. I use the WickedWizard gem to collect information to their Finances model. The finances_welcome controller looks like this:

  def show
    @finance = current_user.finance || current_user.build_finance
    render_wizard
  end

  def update
    @finance = current_user.finance || current_user.build_finance
    @finance.assign_attributes(finance_params)
    render_wizard @finance
  end

The get_started.html.erb view looks like this:

<%= form_for @finance, url: wizard_path, :method => :put do |f|  %>
    <div class="field">
      What's your <strong>name</strong>?<br>
      <%= f.text_field :name %>
    </div>
    <div class="field">
      What's your <strong>birthday</strong>?<br>
      <%= f.date_select :birthday %>
    </div>
    <div class="field">
      What's your <strong>zip code</strong>?<br>
      <%= f.number_field :zip %>
    </div>
    <div class="field">
      What's in between <strong>your legs?</strong><br>
      <%= f.select(:gender, Finance::Gender) %>
    </div>
<%= f.submit "Next", class: "btn btn-primary btn-lg" %>

Hitting /finances_welcome/get_started as an existing user prefills in the inputs from that user's existing Finances model and allows me to update the fields.

However, as a first-time user signing up, I click "Next" and the page just refreshes. There's no error and a new Finances model is not created. (never mind associating that model to the user.)

beaconhill
  • 441
  • 6
  • 28

1 Answers1

1

Turns out my steps were wrong.

New users were being redirected to a step later in the process, meaning the user's required fields on the Finance object were missing.

beaconhill
  • 441
  • 6
  • 28