What are the key elements to implement AJAX logic in rails? ( 5 keys )
How to run alert() from the controller?
# view button_to 'Alert', action_path, remote: true
controller
def action_name
render js: ‘alert(2)’
end
How to run alert() through js partial?
# view button_to 'Alert', action_path, remote: true
# controller def action_name render partial: 'partial_name' end
# _partial_name.js.erb alert()
How to update existing code with rails?
Click the button, and update js and inside js send rails argument