0
我在我的軌道得到一個錯誤3.2.16形式:Rails 3的形式的錯誤 - 錯誤的參數數目(1 2)
<%= form_for @group_member, :as => :group_member, :url => {:action=>'edit_group_member', :id=>@group, :person_id => @group_member.person_id} do |f| %>
<%= hidden_field_tag :person, @group_member.person_id %>
<p><table border="0" cellpadding="3" cellspacing="0">
<tr>
<td><%= f.check_box :admin %></td>
<td><label for="group_member_admin">Group administrator (can modify members and most group properties)</label></td>
</tr>
</table>
</p>
<p>
<%= submit_tag "Save" %>
<%= submit_tag "Cancel" %>
</p>
<% end %>
然後我得到的錯誤:
wrong number of arguments (1 for 2)
Extracted source (around line #7):
4: <%= hidden_field_tag :person, @group_member.person_id %>
5: <p><table border="0" cellpadding="3" cellspacing="0">
6: <tr>
7: <td><%= f.check_box :admin %></td>
8: <td><label for="group_member_admin">Group administrator (can modify members and most group properties)</label></td>
9: </tr>
10: </table></p>
請幫我發現這段代碼有什麼問題。
嗯,看起來沒事。你可以添加'<%= f.method(:check_box).source_location%>'並註釋掉一行錯誤? – BroiSatse
@BroiSatse然後我得到了未定義的方法'source_location'for#<方法:ActionView :: Helpers :: FormBuilder#check_box> – bartski