我有一個部分_new_user_form.html.erb
不能通過當地人parital Rails的
<%= form_for(@user, :remote => true, :html => {:id => 'new_user_form'}) do |f|%>
<strong><%= :form_text %></strong>
<%= f.text_field :email, :placeholder => get_placeholder_text(@board), :size => "30" %>
<%= hidden_field_tag :role, role %>
<%=f.submit "SAVE", :class => "button-small" %>
<% end %>
在show.rb我想使用它,並通過在一些局部變量如下:
<%= render 'users/new_user_form', :locals=> {:role => "Celebrant" } %>
然而我得到這個錯誤:
undefined local variable or method `role' for #<#<Class:0x00000103d5e8b0>:0x00000103d5b930>
我讀了關於通過當地人的文件,這似乎是正確的。我究竟做錯了什麼?
感謝Coreyward回來如此之快。它使用第一行。 – chell