I want to make a button that will change the subscribed column on a user table turn from 0 to 1 or vice versa but I’ve never tried to change the db outside of the new or edit page. How do I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would suggest
The link would be: <%= button_to ‘subscribe’, :confirm => ‘Are you sure?’, :method => :put, :remote => true %>
Define a method called subscribe on the user model
Define a new action in the user controller like