No route matches {:action=>"send_to_client", :controller=>"stages"}
它对应于这一行:
<%= link_to "<span class='icon send-to-client-icon' title='Send to Client' id='send-to-client'> </span>".html_safe, send_to_client_stage_path(@stage), :id => stage.id, :confirm => "This will send #{stage.name.capitalize} to #{stage.client.email}. Are you sure you are ready?" %>
在这种_show_table.html.erb
<%
if @upload != nil
stage = @upload.stage
end
%>
<h1 class="panel-header">Images</h1>
<% if stage == nil %>
<div class="images_menu">
<%= link_to "<span class='icon send-to-client-icon' title='Send to Client' id='send-to-client'> </span>".html_safe, send_to_client_stage_path(@stage), :id => stage.id, :confirm => "This will send #{stage.name.capitalize} to #{stage.client.email}. Are you sure you are ready?" %>
<span class="icon compare-icon" data-url="<%= compare_stage_path(stage)%>" title="Compare Images" id="compare-images"> </span>
</div>
<% end %>
这里是我的routes.rb:
resources :stages do
member do
get :step
get :compare
get :send_to_client
end
end
问题是,这部分_show_table.html.erb
是在我的uploads
模型的视图文件夹...而不是stages
模型。
当我在stages
模型中执行link_to
时,它工作正常。一旦我将它带入uploads
模型中,它会抛出该错误。
为什么会这样?
EDIT1:这里是stages
控制器的send_to_client
行动:
def send_to_client
stage = Stage.find(params[:id])
ClientMailer.send_stage(stage).deliver
if ClientMailer.send_stage(stage).deliver
flash[:notice] = "Successfully sent to client."
redirect_to("/")
else
flash[:notice] = "There were problems, please try re-sending."
redirect_to("/")
end
end
运行'耙routes'看到所有的可用的路线你有。 – 2011-04-27 03:27:27