Check_box_tag RAILS

时间:2015-09-07 09:28:22

标签: ruby-on-rails ruby

表格中的check_box_tag是 <div class= 'col-md-9 form-group'><%=check_box_tag :Stock_permission, "1" %></div>

其中Stock_permission是字符串。但是当我点击提交按钮时,参数被传递,但它没有将其保存在数据库

参数

{"utf8"=>"✓", "authenticity_token"=>"Li3Gf1L/lsMI6LPfGHlfL2TOaDaO9u85FlEmYNgC9YI=", "user_authentication"=>{"name"=>"Ebenezer Raja", "email"=>"ebenezer.raja1@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "permission_type"=>"admin", "login_allowed"=>"1"}, "selected_homes"=>["1", "2", "3", "4", "5", "6", "7", "8", "9"], **"Stock_permission"=>"1"**, "Attention_permission"=>"1", "commit"=>"Submit", "id"=>"3"}

1 个答案:

答案 0 :(得分:0)

因为user_authentication参与者之外的check_box助手。

我假设您使用的是form_for帮助程序,这样的事情可以解决您的问题:

<%= form_for :some, url: some_path do |f| %>
 # some code here
  <div class= 'col-md-9 form-group'>
    <%= f.check_box :Stock_permission, "1" %>
  </div>
 # some code here