我在生产模式下为我的Ruby应用程序收到500内部服务器错误:
Started GET "/invoices/4" for 99.236.159.34 at 2013-07-04 03:48:28 +0000
Processing by InvoicesController#show as HTML
Parameters: {"id"=>"4"}
Rendered invoices/show.html.erb within layouts/application (3.3ms)
Completed 500 Internal Server Error in 7ms
ActionView::Template::Error (undefined method `email_invoice_path' for #<#<Class:0x00000002d9a510>:0x00000002f65980>):
6: <%= link_to " Print Invoice", '#', onclick: "printpage()", :class => 'btn icon-print' %>
7: <a class="btn btn" href="#"><i class="icon-tag"></i> Print Label</a>
8: <a class="btn btn" href="#"><i class="icon-barcode"></i> Print Barcodes</a>
9: <%= link_to " E-mail", email_invoice_path(@invoice), class: "btn icon-envelope" %>
10: </div>
11: <h4>Detail</h4>
12: <dl class="dl-horizontal">
app/views/invoices/show.html.erb:9:in `_app_views_invoices_show_html_erb__548775152257063458_24219280'
我的佣金路线似乎是正确的:
email_invoice /invoices/:id/email(.:format) invoices#send_email
GET /invoices(.:format) invoices#index
POST /invoices(.:format) invoices#create
GET /invoices/new(.:format) invoices#new
GET /invoices/:id/edit(.:format) invoices#edit
GET /invoices/:id(.:format) invoices#show
PUT /invoices/:id(.:format) invoices#update
DELETE /invoices/:id(.:format) invoices#destroy
这是路线代码:
resources :invoices do
member do
match 'email' => 'invoices#send_email', :as => :email
end
end
奇怪的是,email_invoice_path在开发模式下本地工作正常,但在生产模式下的服务器上它无效。