Step 13 Can't get form to redirect to thanks_url

Instructions step 13:
"In the Signups controller, make an action named create. Use signup_params to safely collect data from the form and update the database. After saving to the database, redirect to thanks_url. "

My issue:
In the app, everything in the form is working, except the redirect. After I enter en email, it saves to the db but doesn’t redirect to thanks_url. There is a thanks.erb.html page in the views that is provided with pre written code, I believe it is the one I’m supposed to be redirecting to. Here’s my code in the signups_controller:

class SignupsController < ApplicationController
  def new
    @signup =
  def create 
    @signup = 
    redirect_to 'thanks_url'
  def signup_params

Or, maybe there is an error in my routes.rb file. Here is my code:

Rails.application.routes.draw do
  root 'signups#new'
  get '/thanks' => 'thanks#Pages'   
  resources :signups

And here is the code that was provided in the views for the thanks.erb.html page:

<div class="header">
  <div class="container">
    <p>We'll keep you posted.</p>

Hi @chel7,

In your config/routes.rb file, you need to specify that you want /thanks to be called thanks. Also, the controller name should come before the method (controller#method). Try modifying line 3 to look like this instead:

get '/thanks' => 'pages#thanks', as: :thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.