0
在軌設定的config/application.rb中config.items_per_page = 15
配置變量,並試圖將其輸出到控制器的時候,我發現了一個錯誤:配置變量被拾起的方法
undefined method `items_per_page'
這裏是我的應用程序/controllers/posts_controller.rb:每@ ZachKemp的建議
@posts = Post.where(:is_deleted => 0, :is_hidden => 0).limit(Rails.configuration.items_per_page).order('created_at DESC')
您是否在添加配置變量後重新啓動服務器? –
@ZachKemp修復它!隨意添加,作爲一個解決方案。 – bswinnerton