Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
Rails sorttable.js No route matches [GET] ".../sorttable.js"

I've got Rails 5 app, where I'm trying to add ability to sort table via clickable headers. I tried to use ransack gem but have some issues described here.As an alternative I found some really nice JS library called sortable.js from this site https://kryogenix.org/code/browser/sorttable/ . Followed instructions all I need to do was:

  1. copy/paste sorttable.js into app/assets/javascripts/sorttable.js
  2. put <script src="sorttable.js"></script> at the top of my _pending.list.html.erb
  3. add sortable class into table class

_pending.list.html.erb

<main role="main">
  <div class="left-margin-row top-buffer">
    <div class="col-md-10">
      <% if pending_caregiver_authorizations.any? %>
        <div class="multi-modal">
          <table class="table table-striped table-bordered sortable">
            <thead>
              <tr>
                <th>Name</th>
                <th>Patients</th>
                <th>Requested on</th>
              </tr>
            </thead>
            <tbody>
              <% pending_caregiver_authorizations.each do |authorization| %>
                <tr>
                  <td><%= link_to "#{authorization.registrant.first_name}", registrant_path(authorization.registrant) %></td>
                  <td><%= authorization.created_at.in_time_zone(Time.zone) %></td>
                </tr>
              <% end %>
            </tbody>
          </table>
        </div>
      <% else %>
        <h5>No pending authorizations</h5>
      <% end %>
    </div>
  </div>
</main>

With the above code I gets an error:

ActionController::RoutingError (No route matches [GET] "/caregiver_authorizations/sorttable.js"):

If I move the sorttable.js file to the same folder where partial _pending.list.html.erb lives I'll get the same error.

[Edit]

application.js

//= require jquery
//= require jquery_ujs
//= require jquery.fileDownload
//= require jquery.dataTables.min
//= require bootstrap-sprockets
//= require bootstrap-datepicker/core
//= require bootstrap-select
//= require turbolinks
//= require_tree .
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda