after_create callback in subclass

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

ok, I just reread the activerecord docs and found the answe:

'The callback macros usually accept a symbol for the method they‘re supposed to run, but you can also pass a "method string", which will then be evaluated within the binding of the callback'

So I used after_create 'self.set_role("client")' and it worked fine.