【发布时间】:2009-03-28 06:47:59
【问题描述】:
我在尝试使用资源路由辅助函数时遇到错误
<%= link_to_remote "Delete", {
:method => :delete,
:url=> phone_numbers_url(phone_number_display.id),
:update => "section_phone"
}%>
在我的路线中我有
map.resources :phone_numbers
我收到以下错误
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.to_sym
当我使用时
:url=> phone_numbers_url(:id => phone_number_display.id)
我不再收到错误,但我收到了不稳定的网址
http://localhost:3000/phone_numbers?id=1
我不明白这个错误,因为 phone_number_display.id 不为空
【问题讨论】:
标签: ruby-on-rails activerecord routes