-1
RoR新手在這裏,感謝任何幫助。未定義的方法'to_i'代表:符號
我有以下錯誤:
undefined method `to_i' for :funding_level:Symbol
我試圖通過這兩個funding_level和investment_id從的link_to參數到我的控制器的新方法。
從我的理解中,100值作爲符號而不是對象傳遞,導致出現問題,然後我嘗試將其分配給整數變量@funding_level。
謝謝!
HTML:
<div id="investment-status">
<%= link_to "$100", new_project_funding_path(funding_level: 100,investment_id: @project.id), class: 'btn' %>
</div>
控制器:
def new
@investment = Project.find(params[:investment_id])
@funding_offered = :funding_level
@project_funding = current_user.project_fundings.new(investment: @investment, funding_offered: @funding_offered)
end