1
class ProfilePresenter < ActionView::Base 
 def initialize
  super
  url_for   # i got: You have a nil object when you didn't expect it!
            #        The error occurred while evaluating nil.url_for
 end
end

url_for 不起作用。为什么?

我做了一个这样的新实例

ProfilePresenter.new
4

1 回答 1

1

已解决:当我实例化 ActionView::Base 时,我需要传递控制器实例

于 2010-06-01T22:03:56.197 回答