我的编辑页面中有两个字段 1.domainName 2.logo 当我点击提交按钮时,选择的图片和域名应该更新我尝试下面的表,但它没有更新数据库。
<%= form_for(@company, :multipart => true) do |form| %>
<table style="height: 400px; border: 5px; margin-left: 20px; ">
<tr>
<td width="40%">
<%= form.label :domain_name ,"Domain Name"%>
</td>
<td>
<%= form.text_field :domain_name %><%= form.submit "Add Domain" %>
</td>
</tr>
<tr>
<td>
<%= form.label :company_logo,"Company Logo" %>
</td>
<td>
<%= form.file_field :company_logo %>
</td>
</tr>
</table>
In controller
def update
@company=Company.find_by_company_id(params[:id])
if @company.update_attributes(params[:company]) then
render :text=>"Company Details updated successfully"
end
end