I'm currently trying to create a simple form that takes an email address and puts it into the database as part of the landing page. The form is located on home.html.erband controlled by the controller pages.
I get the following error:
There is no registration of the template / creation, application / creation with {: locale => [: en] ,: formats => [: html] ,: handlers => [: erb ,: builder,: coffee]}. Search: * "/ Users / me / rails_projects / this_project / application / views"
Here is my code:
home.html.erb It has:
<%= form_for(@signup) do |f| %>
<div class="field">
<%= f.text_field :email %>
</div>
<div class="actions">
<%= f.submit "Sign up" %>
</div>
<% end %>
pages It has:
class PagesController < ApplicationController
def home
@title = "Title of my site"
@signup = Signup.new
end
end
Signups the controller has:
class SignupController < ApplicationController
def show
@signup = Signup.new
end
def new
end
def create
@signup = Signup.new(params[:signup])
if @signup.save
else
render 'new'
end
end
end
Signup It has:
class Signup < ActiveRecord::Base
attr_accessible :email
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates(:email, :presence => true,
:length => {:maximum => 40},
:format => {:with => email_regex})
end
I am not sure what is wrong, but when I enter the correct email address in the field, this is the error I get. I googled around to no avail. Your help will be greatly appreciated.