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?
set_categorymethod, or you could to another method likedef opt_category(i,opt)set_category(i)end, can you please explain what do you mean by 'using a params hash without coercing the hash in the controller'?