I have items that can be one of several attributes like red, yellow, green (more complex than this) and they have corresponding is_red, is_yellow, is_green booleans.
I'd like to have an api function to change this value where I pass for example:
id: 12
type: red
in my function have:
item=Item.find(id)
if item.is_ + type == true
item.is_ + type=false
end
How would I do this?
thx in advance
Colorand a methodis_color(color)instead.