2
I’m creating a small college project in Ruby on Rails
and I came across a problem: I have a table called Person
and another call Tools
. People have many tools and every tool and owned by one person.
I need to add a feature that allows the loan of tools between people in the system. For this, I created an attribute called 'loan
' on the table Tools
, that if it has the value 0
means the tool is not borrowed and if it is 1
, that is borrowed. In the view show of the tools, I created a button with the function to borrow the tool.
My problem is how to make this button change the attribute 'loan
' table Tools
of 0
for 1
and vice versa? Someone would have a better solution?