我正在使用 databasedotcom 和 databasedotcom-rails gem,以便从表单提交中生成进入 Salesforce 的潜在客户。它是独立工作的,直到我将控制器嵌套在父级下,现在当我按下提交时,我收到此路由错误:
No route matches [POST] "/events/516ee9a0421aa9c44e000001/leads/new"
这是我的所有代码:
resources :events do
resources :leads
end
class LeadsController < ApplicationController
include Databasedotcom::Rails::Controller
def new
@lead = Lead.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @lead }
end
end
def create
@lead = Lead.new(params[:lead])
@lead.event_id = params[:event_id]
@lead['OwnerId'] = '005b0000000WxqE'
@lead['IsConverted'] = false
@lead['IsUnreadByOwner'] = false
respond_to do |format|
if @event_lead.save
format.html { redirect_to @lead, :notice => 'Lead was successfully created.' }
format.json { render :json => @lead, :status => :created, :location => @lead }
else
format.html { render :action => "new" }
format.json { render :json => @lead.errors, :status => :unprocessable_entity }
end
end
end
end
<%= simple_form_for [@event, @lead], url: new_event_lead_path do |f| %>
<%= f.input :Download_Brochure__c, :check => "true", :as => :boolean, :as => :hidden %>
<%= f.input :FirstName %>
<%= f.input :LastName %>
<%= f.input :Company %>
<p>Also interested in:</p>
<%= f.input :Sponsor_Request__c, :as => :boolean, :label => "Sponsoring" %>
<%= f.input :Presenting__c, :as => :boolean, :label => "Presenting" %>
<%= f.input :Newsletter_Signup__c, :as => :boolean, :label => "Newletter" %>
<%= f.input :Privacy_Policy__c, :as => :boolean, :checked => true, :label => "Would you like to stay updated" %>
<%= f.button :submit, :label => "Submit" %>
<% end %>