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

160
Views
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
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!