"undefined method 'address_line_1' for nil:NilClass"
当用户尝试访问他们的个人资料页面时,我的应用程序似乎随机抛出错误。
奇怪的是它说错误发生在一个完全不相关的布局视图中,我看不到任何迹象表明布局甚至被调用(因为它与编辑视图无关)。
GET peoplecontacter.heroku.com/pages/5/edit dyno=web.1 queue=0 wait=0ms service=20ms bytes=934
2011-03-31T15:19:47-07:00 app[web.1]:
2011-03-31T15:19:47-07:00 app[web.1]: ActionView::Template::Error (undefined method `address_line_1' for nil:NilClass):
2011-03-31T15:19:47-07:00 app[web.1]: 44: #{@page_content.address_line_1}
2011-03-31T15:19:47-07:00 app[web.1]: app/views/layouts/pages/page_splitheader.html.haml:44:in `_app_views_layouts_pages_page__splitheaderhtml_haml___1138718096_23705833586020_0'
无论我从前一个customer_account
视图中单击帐户,还是刚刚单击页面的显示视图并点击浏览器的后退按钮,返回到编辑视图,有时都会引发错误。但是我在节目中没有得到错误,这是唯一@page_content.address_line_1
应该执行的地方。
提前感谢您的帮助! - 标记