1
這裏新增了rails。我收到@name的值的空值接收#Profile :: ActiveRecord_Relation:0x00007f3dec9ae7b0將值從控制器傳遞到視圖rails
控制器
def index
@name = Profile.where(session[:id])
end
指數HTML
<%= form_for :value, url: value do |f| %>
<!------ This form_for is for the post/create into the another table---->
<%= f.hidden_field :message, :value => @name %>
我有一個form_for發佈一個值到另一個表中幷包含一個hidden_field以插入到另一個表中。基本上我想檢索這個人的名字,並把名字分配給:value => @name。但它給出了不同的價值。非常感謝您的幫助
'where(session [:id])''沒有任何意義。你的意思是'find(session [:id])'? – meagar