复选框参数不返回?

时间:2018-07-10 16:35:21

标签: ruby-on-rails ruby checkbox parameters twilio

我正在尝试使长时间运行(带有睡眠)的功能仅在当前选中复选框的情况下才在循环中执行特定操作。但是,当我执行if params[:calls_check].eql?('1')时,我似乎无法使它返回除false以外的任何内容。有什么建议吗?

查看:

<body>
    <div class="buttonDiv w3-display-middle">
        <%=form_tag landing_make_calls_path, method: :get do %>
          <%= check_box :calls_check, id: "calls_check" %>Make Calls
          <%= submit_tag "Start Call Sequence"%>
        <%end%>
    </div>
</body>

控制器:

def individual_call(to_phone, xml_url)
    binding.pry
    if params[:calls_check].eql?('0')
        call = @client.calls.create(
                               url: xml_url,
                               to: to_phone,
                               from: '+13474275841',
                               timeout: 20
                             )

        puts call.sid
        puts "in loop"
    end
  end

我的撬动结果:

[4] pry(#<LandingController>)> params[:calls_check].eql?('1')
=> false
[5] pry(#<LandingController>)> params[:calls_check]
=> <ActionController::Parameters {"{:id=>\"calls_check\"}"=>"1"} permitted: false>

任何帮助将不胜感激!

0 个答案:

没有答案