Topic: Object#send for activerecord method
I have an activerecord object called @employee, which has a method called product_id (the employees table has a product_id field). I need to set this field to something, which I can do like this in irb:
@employee.product_id # => 2
However, I need to set this using Object#send, and this is what happens when I try in irb:
@employee.send("product_id") # => 2
@employee.product_id # => 2 (from the previous set)
In other words, it appears send is returning the reader method for @employee, but not the setter method. Why is this and is there any way to use send to SET this field? Thanks.