我在我的Rails应用程序中创建了一个名为Leads的脚手架。该表有1个属性,即:电子邮件。Rails 5 - 在根页面中嵌入了注册表兴趣表格
我的目标是呈现主页中的表单输入字段。
我有一个HomeController,我已经添加了这个“新”方法。
class HomeController < ApplicationController
def new
@lead = Lead.new
end
end
在家庭/索引视图,我有:
<%= render 'leads/form', lead: @lead %>
在窗体部分我:
<%= simple_form_for Lead.new do |f| %>
<%= f.input :email, :label => false, :placeholder => "your email address", input_html: { class: 'cform' } %>
<span style="float:right"><%= f.button :submit, 'Go', class: 'cformbutton' %></span>
<% end %>
我试图按照this post的建议得到在home索引中显示的表单输入字段。
我无法找到一种方法使其工作。
它工作正常的发展环境,但后来当我推到Heroku的,我得到一个错误,指出:
FATAL -- : [a6e63810-1660-4e83-86d9-bfd6ae54b344] ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "leads" does not exist
2017-03-01T21:19:11.541780+00:00 app[web.1]: F, [2017-03-01T21:19:11.541735 #4] FATAL -- : [a6e63810-1660-4e83-86d9-bfd6ae54b344]
2017-03-01T21:19:11.541824+00:00 app[web.1]: LINE 8: WHERE a.attrelid = '"leads"'::regclass
我lead.rb上有没有关联。我不明白为什么需要有任何关联。
任何人都可以看到我需要做什么才能使此表单在生产环境中工作吗?
感谢 - 我不能给分另有19个小时。 – Mel