Star rating on my simple-form Rails does not send the value

Asked

Viewed 107 times

0

I’m using a Jquery plugin to style an input field of mine with the style of "star rating", and this is the library: http://plugins.krajee.com/star-rating.

I call the attribute in slim the following way:

td = f.input :score, label: false, input_html: {class: 'rating'}

And then his look is like the following image:

inserir a descrição da imagem aqui

And my generated HTML for this form is as follows:

<form novalidate="novalidate" class="form-vertical edit_arquivo" id="edit_arquivo_1" action="/documentos/1/arquivos/1" accept-charset="UTF-8" method="post"></form>
<input name="utf8" type="hidden" value="✓">
<input type="hidden" name="_method" value="patch">
<input type="hidden" name="authenticity_token" value="HPAt+RG4IluAdpIhsNSdMw/tFQ2PF0CzIWUGhUwkZ+AXcyy0fZOLSW+EYMAkt1m56s+KMW25aEbce/MtfNjwwA==">
<tr>
   <td>
      <div class="form-group integer optional arquivo_score">
       <div class="controls">
         <div class="star-rating rating-xs rating-active">
           <div class="rating-container rating-gly-star" data-content="">
             <div class="rating-stars" data-content="" style="width: 80%;"></div>
               <input class="numeric integer optional rating form-control hide" type="number" step="1" name="arquivo[score]" id="arquivo_score"></div>
         </div>
       </div>
     </div>
   </td>
   <td>
    <input type="submit" name="commit" value="Atualizar Arquivo" class="btn btn-default btn btn-default btn-primary btn-large"/>
   </td>
</tr>

But for some reason I have no idea, the file_score parameter is not sent to my controller, as the package shows:

Started PATCH "/documentos/1/arquivos/1" for ::1 at 2015-02-20 17:18:53 -0300
Processing by ArquivosController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"wB2bfSO4VgQyZ+No4zu5OY8hYgsO7WWI1GzSJ9E05LDLnpowT5P/Ft2VEYl3WH2zagP9N+xDTX0pcieP4chzkA==", "arquivo"=>{"cancelado"=>"0", "observacao"=>""}, "commit"=>"Atualizar Arquivo", "documento_id"=>"1", "id"=>"1"}

Can anyone give me a light of what’s going on? What I’ve noticed is that this field has a field called data-content, that others do not possess, but still some value should be passed, no?

  • Dude, put the full Rails code, controller, view (_form) D

  • You don’t know much about it, but did you check if the library changes the value (value) of the field? The only thing that matters for Rails is the value that comes from input.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.