1
我有一組偏好用於根據用戶的選擇從下拉菜單更新表格的一部分。有很多不同的選擇,因此而不是像這樣的視圖文件夾:如何將部分當前文件夾添加到導軌視圖路徑?
app/views/myview/
_choice001.html.erb
_choice002.html.erb
...
_choice998.html.erb
_choice999.html.erb
_form.html.erb
_sharedchoicestuff1.html.erb
_sharedchoicestuff2.html.erb
edit.html.erb
new.html.erb
我想展示出來是這樣的:
app/views/myview/
choices/
_choice001.html.erb
_choice002.html.erb
...
_choice998.html.erb
_choice999.html.erb
_sharedchoicestuff1.html.erb
_sharedchoicestuff2.html.erb
_form.html.erb
edit.html.erb
new.html.erb
如果我這樣做,那麼我知道我需要將render :partial => whatever
更改爲render :partial => "myview/choices/#{whatever}"
這在表單中是可以的,但我不想在所有選擇模板中更改它。有沒有辦法添加'。'到視圖路徑,所以我仍然可以在選擇模板中使用render :partial => 'sharedchoicestuff1'
。