In one of my models I have code like this:
def lendable_category=(i)
set_category(i)
end
def free_category=(i)
set_category(i)
end
def skill_category=(i)
set_category(i)
end
The methods are virtual parameters which I’ve added so I can save an object using a params hash without coercing the hash in my controller.
It doesn’t feel great to say the same thing three times. Is there a better way to create identical methods like this?
1 Answer