我在我的活动管理界面中添加了以下内容:
action_item :only => :show do
link_to('Approve this article', approve_admin_article_path(article)) if article.approved.nil?
end
member_action :approve, :method => :get do
# do approval
redirect_to :action => :show, :notice => "Approved!"
end
这会引发以下错误:
:Arbre::HTML::Article 的未定义方法“已批准”
我认为正在发生的是 Active Admin 认为我正在传递文章标签,而不是文章类?
有谁知道解决这个问题?也许混叠?
谢谢!
类文章 < ActiveRecord::Base
attr_accessible :正文
# 关系:belongs_to:articleable,多态:true,:counter_cache => true has_many:comments,as::commentable,order:'created_at DESC',依赖::destroy
# 验证 validates_presence_of :body validates_length_of :body, 最大值:15000
结尾