当我在我的应用程序\ u controller.rb中放入一些代码时,我在Active Admin中遇到了一个错误。错误是(在active admin中尝试访问HomeConfig时):
undefined method 'except' for #<HomeConfig:0x007f8877cfda58>
在本例中,当我将此代码放入application\ u controller.rb时会出现错误:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
# Code that cause the problem
before_filter :contact_info, :home_config
def contact_info
@contact_infos = ContactInfo.all
end
def home_config
@home_configs = HomeConfig.last
end
end
Started GET "/alumni/admin/home_configs" for 127.0.0.1 at 2018-10-02 09:07:38 -0300
Processing by Admin::HomeConfigsController#index as HTML
HomeConfig Load (0.4ms) SELECT `home_configs`.* FROM `home_configs` ORDER BY `home_configs`.`id` DESC LIMIT 1
AdminUser Load (0.3ms) SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 1 ORDER BY `admin_users`.`id` ASC LIMIT 1
Rendered /Users/Atua/.rvm/gems/ruby-2.1.3@facensAlumni/bundler/gems/activeadmin-dce083189c46/app/views/active_admin/resource/index.html.arb (598.9ms)
Completed 500 Internal Server Error in 644ms
NoMethodError - undefined method `except' for #<HomeConfig:0x007f887c002d58>:
Started POST "/__better_errors/32ad65699eb25cf6/variables" for 127.0.0.1 at 2018-10-02 09:07:39 -0300
ContactInfo Load (0.3ms) SELECT `contact_infos`.* FROM `contact_infos`
如果我撤回此代码并重新启动服务器,一切正常。有人知道发生了什么吗?
谢谢。