I have a User model with a protected method defined:
def set_role(rolename)
role = Role.find_by_rolename(rolename)
permission = Permission.new
permission.role = role
permission.user = self
permission.save(false)
end
and a subclass with:
after_create set_role(‘client’)
This always fails for me with the error:
undefined method `set_role’ for #Class:0x2798838
however, if I call it with a symbol:
after_create :set_role
it finds the method, but fails with a “wrong number of arguments” (as
you would expect).
How can I call the method as a symbol and pass arguments at the same
time?
thanks
dorian