我正在使用此代码:
ActiveAdmin.register_page "Dashboard" do
section "Recent Posts" do
table_for Post.order("id desc").limit(15) do
column :id
column "Post title", :title do |post|
link_to post.title,[:admin,post]
end
column :category,sortable: :category
column :created_at
end
strong (link_to "Show all posts")
end
end
我收到这个错误:
undefined method `section'
如果我删除“部分”执行结束部分,则会出现以下错误:
undefined method `table_for'
等等...
似乎我无法使用任何主动管理员给定的方法,也许我错过了什么?有 gem 什么的吗?我使用此设置安装了事件管理 gem:
gem 'inherited_resources', github: 'activeadmin/inherited_resources'
gem 'activeadmin', github: 'activeadmin'
gem 'devise', github: 'plataformatec/devise'
我正在使用 rails 5
最佳答案
我设法转换了我的代码,现在它编译没有任何错误。
ActiveAdmin.register_page "Dashboard" do
content :title => proc{ I18n.t("active_admin.dashboard") } do
columns do
column do
panel "Recent Posts" do
table_for Post.order("id desc").limit(5) do
column :name do |post|
link_to post.title, [:admin, post]
end
column :created_at
end
strong (link_to "Show All Posts" , :posts )
end
end
end
end
end
我想我以前使用的语法是旧的,不再受支持。
关于ruby-on-rails - Rails 事件管理员未定义的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39896017/