On Rails的4當我執行了一個裝飾我得到了以下錯誤RSpec的測試: /app/spec/decorators/my_decorator_spec.rb:3:in `<top (required)>': uninitialized constant MyDecorator (NameError)
我肯定失去了一些東西,但我不知道是什麼。 我生成 rails g decorator My
使用Rails 5我加入了寶石 gem 'draper', '3.0.0.pre1'
然後當我打電話安裝發電機,我得到一個錯誤 Could not find generator 'draper:install'. Maybe you meant 'devise:install', 'config:install' or 'responders:install'
什麼林做錯了這裏?
我在app/decorators/post_decorator.rb中有PostDecorator類。 它有一個調用Devise的current_user方法的方法。它看起來像這樣: class PostDecorator < Draper::Decorator
delegate_all
def voter
h.current_user
end
end