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 each tool is owned by one person.
I need to add a resource that enables the loan of tools among the people in the system. For this, I created an attribute called ' loan
' in the Tools
table, which if it has the value 0
means that the tool is not lent and if it is 1
, that is lent. In the tool view, I created a button with the function to borrow the tool.
My problem is how to make this button change the attribute ' loan
' from table Tools
from 0
to 1
and vice versa? Would anyone have a better solution?