我有以下
- 页面模型
- 客户模型
- 商业模式
这些模型之间没有任何关系。
我想在页面的显示模板上有 Form_for 的
- 一份给客户
- 一个为企业
这可能吗?
目前有以下:
<div id="sidebar">
<%= form_for (@business) do |f| %>
<div id="contact_form_name">
<p>Company</p>
<%= f.text_field :company_name, :class =>'form_input_small' %>
<%= f.submit 'Submit', :class => 'button' %>
<% end %>
</div>
<div id="sidebar">
<%= form_for (@client) do |f| %>
<div id="contact_form_name">
<p>First Name</p>
<%= f.text_field :first_name, :class =>'form_input_small' %>
<%= f.submit 'Submit', :class => 'button' %>
<% end %>
</div>
我在日志中出现的错误如下
<div id="sidebar">
78: <%= form_for (@business) do |f| %>
79: <div id="contact_form_name">
80: <p>Company</p>
81: <%= f.text_field :company_name, :class =>'form_input_small' %>
app/views/pages/show.html.erb:78:in `_app_views_pages_show_html_erb___1556847543_65073939124600'
app/controllers/pages_controller.rb:9:in `show'
路线
businesses GET /businesses(.:format) {:action=>"index", :controller=>"businesses"}
POST /businesses(.:format) {:action=>"create", :controller=>"businesses"}
new_business GET /businesses/new(.:format) {:action=>"new", :controller=>"businesses"}
edit_business GET /businesses/:id/edit(.:format) {:action=>"edit", :controller=>"businesses"}
business GET /businesses/:id(.:format) {:action=>"show", :controller=>"businesses"}
PUT /businesses/:id(.:format) {:action=>"update", :controller=>"businesses"}
DELETE /businesses/:id(.:format) {:action=>"destroy", :controller=>"businesses"}