Hi, can someone please help me figure out what I'm doing wrong?
When I submit an email address, I get an error:
Started POST "/signups" for 174.21.34.60 at 2015-10-24 14:00:29 -0400
Processing by SignupsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"3zOsHWDDohipOnmYjT1y2TRaSDXawNvDbwkC36FzP0g=", "signup
"=>{"email"=>"marco@example.com"}, "commit"=>"signup"}
Completed 400 Bad Request in 0ms
ActionController::ParameterMissing (param is missing or the value is empty: email):
app/controllers/signups_controller.rb:19:in `signup_params'
app/controllers/signups_controller.rb:9:in `create'
Here is my signup controller:
class SignupsController < ApplicationController
def new
@signup = Signup.new
end
def create
@signup = Signup.new(signup_params)
if @signup.save
redirect_to '/thanks'
else
render 'new'
end
end
private
def signup_params
params.require(:email)
end
end
The email field is in the schema - migrate scrip:
create_table :signups do |t|
t.text :email
t.timestamps
It's baffling to me, the email parameter is there, but it's not being saved (it just says 'nil' in the DB). Any ideas?
Thanks!
Marco