2012-12-07 55 views
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') 
+4

您是否在添加配置變量後重新啓動服務器? –

+0

@ZachKemp修復它!隨意添加,作爲一個解決方案。 – bswinnerton

回答

0

爲,重新啓動解決這個問題的軌道服務器。