我有这个错误
ArgumentError (wrong number of arguments (1 for 0)):
lib/law/production.rb:20:in `clone'
lib/law/production.rb:20:in `clone_law'
lib/law/production.rb:11:in `initialize'
app/controllers/laws_controller.rb:86:in `new'
app/controllers/laws_controller.rb:86:in `prod_law'
app/controllers/laws_controller.rb:44:in `create'
使用这个时
module Law
class Production
attr_accessor :law
attr_accessor :creator
def initialize(law,current_user)
@law = law
@creator = current_user
clone_law
end
def current__user
User.find_by_authentication_token(session[:_csrf_token])
end
def clone_law
clone(@law)
end
end
end
其中clone
, create
,是我假设的prod_law
一些方法,但我不明白为什么Rails
hash