Ruby on rails Rails管理员没有列出记录

Ruby on rails Rails管理员没有列出记录,ruby-on-rails,model,action,rails-admin,Ruby On Rails,Model,Action,Rails Admin,因此,我为我的mongoid模型做了一个自定义操作,用于将XSL文档上传到MongoDB。 这个操作运行得很好,我可以看到XSL文档和模型记录保存在数据库中,它将我返回到我的列表,在那里我可以查看样式表的名称等 当我尝试从操作外部访问此列表时(即浏览到/admin/xsl_sheet),我得到“无需显示”。我不明白为什么会这样 型号: require 'mongoid/grid_fs' class XslSheet include Mongoid::Document scope :a

因此,我为我的mongoid模型做了一个自定义操作,用于将XSL文档上传到MongoDB。 这个操作运行得很好,我可以看到XSL文档和模型记录保存在数据库中,它将我返回到我的列表,在那里我可以查看样式表的名称等

当我尝试从操作外部访问此列表时(即浏览到/admin/xsl_sheet),我得到“无需显示”。我不明白为什么会这样

型号:

require 'mongoid/grid_fs'

class XslSheet
  include Mongoid::Document

  scope :applicationId, -> {where(assetable_id: User.current_user.current_scope['Application']) unless User.current_user.nil? or User.current_user.current_scope.nil?}

  belongs_to :application
  validates_uniqueness_of [:data_file_name, :stylesheet_id], :scope => :assetable_id

  field :data_file_name, type: String
  field :assetable_id, type: Integer
  field :stylesheet_id, type: BSON::ObjectId
end
rails_admin.rb:

# XslSheet
c.model XslSheet do
  label Proc.new {"Xsl Sheet"}
  navigation_label Proc.new {I18n.t('navigation.actions')}
  weight 303
  navigation_icon 'fa fa-envelope-o'
  list do
    binding.pry
    scopes [:applicationId]
    field :data_file_name
    field :assetable_id
    field :stylesheet_id
  end
end
值得注意的是,当我通过浏览列表访问它时,rails_admin.rb中的binding.pry会被触发。
当我创建一个新的
XslSheet
并被重定向时,它不会在绑定中捕获。

我将模型保存到错误的数据库中

我切换到另一个DB来保存样式表,忘记切换回默认值来保存记录