这是我的看法:
<%= link_to_remote "Responded - Positive",
:url => contact_path(@contact, :status => 'positive response'),
:update => "status" %>
这就是我的路线:
map.resources :contacts, :has_one => :status_contact
这是我在控制器中使用的:
def create
@status_contact = StatusContact.new(params[:status_contact])
if @status_contact.save
#flash[:notice] = "Successfully created status contact."
#redirect_to @status_contact
render :text => "Set status to #{@status_contact.status}."
else
render :text => "bomb"
end
end
我想要的结果是,对于特定的联系人,它将使用值“积极响应”更新属性 Contact.status 并通过 ajax 执行此操作。
现在,我收到 404 错误。我需要做什么来纠正这个问题?
这是我仍然得到的错误:
POST http://localhost:3000/contacts/24?method=put&status=positive+response 404 Not Found
312ms