11/14 email form not working


#1

Does anyone have the code to get the email form to display? Mine gets an error message

 <% form_for(@signup) do |f| %>
	<div class="field">
    <% f.label :email %><br>
    <% f.string :email %>
    </div>
	<div class="action">
    <% f.submit "Create" %>      
    </div>
<% end %>

#2

I made the same mistake as you.
You should have f.text :email

Whole form is like this:
<%= form_for(@signup) do |f| %>


<%= f.label :email %>

<%= f.text_area :email %>


<%= f.submit "Submit" %>

<% end %>

But you can't just change it by typing it. You have to start over from the beginning. When you get to step 5. db/migrate, you have to type this

t.text :email

Hope that helps.


#3

I'm running into the same thing. I think I corrected everything as shown above, but still no go.

This is from the migration file:
class CreateSignups < ActiveRecord::Migration
def change
create_table :signups do |t|
t.text :email
t.timestamps
end
end
end

And this is from the new signups page:
<%= form_for(@signup) do |f| %>


<%= f.label :email %>

<%= f.text_area :email %>


<%= f.submit "Submit" %>

<% end %>

The error message I get is:

Showing /home/ccuser/workspace/learn-rails_innovation-cloud/innovation-cloud/app/views/signups/new.html.erb where line #41 raised:

undefined method `email' for #

Am I missing something?


#4

try changing

 <%= f.text_area :email %>

to

<%= f.text :email %>

Does that work?


#5

This is an old post but still relevant for anyone having this problem. I think I found the problem on your code.

This code has a small problem:
<% form_for(@signup) do |f| %>

It should be
<%= form_for(@signup) do |f| %>

The = was missing.