Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

70
Views
Cómo configurar jQuery correctamente para Rails v5.2

Mis vistas/comentarios/create.js.erb JS no funciona y mi erb da algún resultado, configuro mi jQuery agregando

 gem 'jquery-rails', '~> 4.4'

Agrupé mi aplicación Rails e hice cambios en app/asset/javascript/application.js con los requisitos de la siguiente manera

 //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . //= require activestorage

Entonces, cuando escribo mi js para crear una acción de comentario en app/views/comments/create.js.erb

 $('#comment_content').val('') $('#comment_div').prepend(<%= j render @comment %>)

Y tengo un parcial con _comment.html.erb

 <%= comment.created_at.strftime("%l:%M:%p")%> <b><%= comment.user.username %></b> <%= comment.content %> <br>

Ahora no sé dónde me equivoqué al configurar mi jquery

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La respuesta a esto es usar "" en la función anteponer al igual que

 $('#comment_content').val('') $('#comment_div').prepend("<%= j render @comment %>")
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!