这是我在视图中的代码,只是调用编辑建议路径
<%= link_to "Edit this Proposal", edit_idea_proposal_path %>
这是我在Proposals Controller中的代码。我显然有一个" Edit“操作,那么为什么它会给我一个Edit的路由错误呢?
def create
@idea = Idea.find(params[:idea_id])
@proposal = @idea.proposals.create(params[:proposal])
if @proposal.save
flash[:success] = "Thanks for the Proposal!"
redirect_to idea_proposals_url(@idea)
else
render 'new'
end
end
def edit
@idea = Idea.find(params[:idea_id])
@proposal = @idea.proposals.find(params[:id])
end
def update
@idea = Idea.find(params[:idea_id])
@proposal = @idea.proposals.find(params[:id])
if @proposal.update_attributes(params[:proposal])
redirect_to idea_proposals_url(@idea)
else
render 'edit'
end
end发布于 2012-07-12 06:55:41
解决这个问题后,我需要将视图中的代码从:
<%= link_to "Edit this Proposal", edit_idea_proposal_path %>至:
<%= link_to "Edit this Proposal", edit_idea_proposal_path(@idea, proposal) %>https://stackoverflow.com/questions/11442475
复制相似问题