I am trying to make it so that a function that executes over a long period of time (with sleeps) only does a specific action in a loop if the checkbox is currently checked. However I can't seem to get it to return anything but false when I do if params[:calls_check].eql?('1')
. Any suggestions?
View:
<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>
Controller:
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
And my results from my pry:
[4] pry(#<LandingController>)> params[:calls_check].eql?('1')
=> false
[5] pry(#<LandingController>)> params[:calls_check]
=> <ActionController::Parameters {"{:id=>\"calls_check\"}"=>"1"} permitted: false>
Any help would be greatly appreciated!
Aucun commentaire:
Enregistrer un commentaire