這裏是我的press_post/updater.rb文件有沒有辦法來命名空間的PORO類沒有模塊
class PressPost::Updater
def say_something
p 'hello world'
end
end
但是當我運行的東西我得到這個 「:未初始化不斷PressPost(NameError)
我知道其他答案已經觸及這個.. 一個竟然在第一行的類文件中創建一個空模塊..這似乎有瑕疵。
我知道有一種方法不必做這個額外的代碼。我相信這是一個配置或什麼的,但我不知道如何做到這一點。
注意..我想這樣做,因爲這是一個子目錄,這是一個容易許多搜索比更新
請參閱http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#nesting和http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#nesting-and-qualified-constants。 –