I'm new at Ruby so my question may be really simple.
I have a table with rows (the users for example) and columns with information such as Name Adress PhoneNumber, and I'd like to put a link in the end of each row to create automatically (if I click on the link) a row in another table in my database, using the information of the user (on the row).
How should I do that ? How to create a button or a link, and where to write the code to add a row in a different table using those information ?
I'm sorry if my question isn't clear. Thank you !
I found the solution, in case someone needs it: We have to touch the routes, the controller and the view.
About the routes: we just have to add a root to a method we'll create in the controller.
About the controller: create this method and put it in something like "other = Other.new( and the parameters here)" and then the save part which is just like the function create !
About the view: put a button_to function, specifying the path and the data we want to send to the controller.
Cheers
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.