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

161
Visualizações
Ruby on Rails conditional Confirm Dialog in link_to tag

I want display a confirm dialog, If the user presses yes then I want to update that a certain attribute along with another attribute but if yes presses no then I want to update only a single attr. Code So Far

  member_action :move_to_research do
   puts 'working'
   redirect_to admin_credit_appraisal_path, notice: 'working'
  end

action_item :move_to_research do
link_to 'sss', move_to_research_admin_credit_appraisal_path, data: { confirm: 'Are you sure?'}

# link_to 'aSasaS', move_to_research_admin_credit_appraisal_path(id: resource.id), class: 'edit', data: { toggle: 'modal', target: '#move_to_research_modal' }
# link_to 'move_to_research', move_to_research_admin_credit_appraisal_path(id: resource.id), class: 'btn', data: { toggle: 'modal' }
# javascript_tag "alert('All is good')", type: 'application/javascript'
# link_to 'Another link with obtrusive JavaScript', '#', onclick: "if (confirm('Are you sure you want to save this thing into the database?')) {
#   // Save it!
#   console.log('Thing was saved to the database.');
# } else {
#   // Do nothing!
#   console.log('Thing was not saved to the database.');
#   return;
# }"
end

I also tried making an HTML page with a link that sends AJAX request to the server to conditionally update the attributes, but has been unsuccessful

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