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