0
在我看來,我渲染了一個部分。Rails:模板錯誤「動態常量賦值」
部分的名稱由產品頁面的名稱構成。
<%= render :partial => "product_pages/" + selected.headline %>
在測試案例中,標題是「電子」。
所以我也試過:
<%= render :partial => "product_pages/electronics"
爲了測試部分觀點如下:
<p>Test</p>
現在我得到這個錯誤,我不明白:
ActionView::Template::Error (/var/www/*****/app/views/product_pages/_Elektro
nik.html.erb:1: dynamic constant assignment
...r = @output_buffer;Elektronik = local_assigns[:Elektronik];;...
... ^):
1: <p>Test</p>
app/views/pages/_content.html.erb:13:in `_app_views_pages__content_html_erb__4
0580468132849538_266915680_1201196437383914942'
app/views/pages/index.html.erb:3:in `_app_views_pages_index_html_erb__43007964
38685262523_267219620_562910368159856764'
Elektronik在您的視圖中的任何地方提及? –
另請參見[動態常量分配](http://stackoverflow.com/questions/6712298/dynamic-constant-assignment)。當然是 –