如何將符號參數傳遞給實例的屬性?如何將符號傳遞給實例的屬性?
<%= image_input_and_display(f, :footer, '1140 x 104 pixels') %>
def image_input_and_display(f, symbol, hint)
f.input symbol, hint: hint
if @user.symbol.exists?
...
end
end
我試圖讓函數運行,在這種情況下,if @user.footer.exists?
。任何線索?
啊!很簡單。謝謝。 –
也很好的建議。它只是訪問一個屬性,但這真的很值得注意。 –