Calcular Precio por cantidad

Señores Buenas con todos… Por favor necesito ayuda con este código, estoy tratando de calcular el resultado una vez ingresado la cantidad y el precio con simple_form, y automáticamente debe salir el resultado total, sin que haya presionado grabar o actualizar, y también sin la necesidad de usar código javascript, u otra plataforma. quiero que salga en el mismo archivo html ya con el embedido de ruby on rails. me sale solamente cero, no lo llama a los parámetros cantidad y precio , adjunto el código:

  1. <%= simple_form_for(@ticket) do |f| %>

  2. <%= f.error_notification %>

  3. <div class="form-inputs">
    
  4. <%= f.input :fecha %>
    
  5. <%= f.input :impuesto, :input_html => { value: '18.00'} %>
    
  6. <%= f.association :customer, label_method: "#{:nombre}", value_method: :id, prompt: "Debes buscar la empresa" %>
    
  7. <%= f.association :status %>
    
  8. <div>
    
  9. <table id="items">
    
  10.       <tr>
    
  11.         <th class="text-center" width="60px">ITEM</th>
    
  12.         <th class="text-center" width="160px">CODIGO</th>
    
  13.         <th class="text-center" width="225px">DESCRIPCION</th>
    
  14.         <th class="text-center" width="100px">CANTIDAD</th>
    
  15.         <th class="text-center" width="110px">PRECIO</th>
    
  16.         <th class="text-center" width="150px">TOTAL <%= @empresa.moneda1 %></th>
    
  17.         <th></th>
    
  18.       </tr>
    
  19. </table>    
    
  20. <%= simple_nested_form_for @ticket, :wrapper => false do |g| %>

  21. <table id="detail_tickets">
    
  22. <%= g.simple_fields_for :detail_tickets do |p| %>
    
  23. <tr class="fields">
    
  24.     <th align="center" width="60px" class="text-center"><%= p.input :item, label: false %></th>
    
  25.     <th align="center" width="160px"><%= p.input :code, label: false %></th>
    
  26.     <th align="center" width="225px" class="description"><%= p.input :description, label: false, :input_html => {:rows => 3} %></th>
    
  27.     <th align="center" width="100px" class="text-center"><%= p.input :cantidad, label: false %></th>
    
  28.     <th align="center" width="110px" class="text-right"><%= p.input :price, label: false %></th>
    
  29.     <% @total_price = params[:cantidad].to_s.to_d * params[:price].to_s.to_d %>
    
  30.     <th align="right" width="150px" class="text-right"><%= @total_price %></th>
    
  31.     <th align="center" width="63px" class="text-center"><%= p.link_to_remove "", class: "btn btn-danger fa fa-trash" %></th>
    
  32. </tr>
    
  33. <% end %>
    
  34. </table>
    
  35. <table id="items">
    
  36.     <tr>
    
  37.         <th width="700px"></th>
    
  38.         <th class="text-center" width="110px">VALOR DE VENTA : </th>
    
  39.         <th class="text-center" width="150px"></th>
    
  40.     </tr>
    
  41.     <tr>
    
  42.         <th width="700px"></th>
    
  43.         <th class="text-center" width="110px">I.G.V. : </th>
    
  44.         <th class="text-center" width="150px"></th>
    
  45.     </tr>
    
  46.     <tr>
    
  47.         <th width="700px"></th>
    
  48.         <th class="text-center" width="110px">TOTAL : </th>
    
  49.         <th class="text-center" width="150px"></th>
    
  50.     </tr>
    
  51. </table>
    
  52. <br>
    
  53. <br>
    
  54. <p><%= g.link_to_add "Adicionar Producto", :detail_tickets, :data => { :target => "#detail_tickets" }, class: "btn btn-primary" %></p>
    
  55. <%= f.button :submit %>
    
  56. <% end %>

  57. <% end %>

``