我想查找ActionMailer
方法接受的参数数量。
我的邮件代码:
UserMailer < ActionMailer::Base
def signup(arg1)
end
end
我试过(在rails控制台中):
# NameError: undefined method `UserMailer.signup' for class `Object'
method('UserMailer.signup').arity
# NameError: undefined method `signup' for class `Class'
UserMailer.method('signup').arity
# NoMethodError: private method `new' called for UserMailer:Class
UserMailer.new.method('signup').arity
答案 0 :(得分:2)
这应该这样做:
UserMailer.instance_method(:signup).arity