Rails:部分渲染因ActiveModel-Object而失败

时间:2017-02-20 06:53:36

标签: ruby-on-rails ruby-on-rails-5 orientdb activemodel

我正在使用OrientDB作为数据库设置rails5项目(ActiveOrient,https://github.com/topofocus/active-orient

我有两个型号" Basiswert"和" Aktie",都提供了一种方法" to_partial_path"和" to_parm"并且应该有资格进行部分渲染

fast =  Basiswert.like 'fast*'
fast.first.to_partial_path
 => "basiswerte/basiswert"
fast.first.aktie.to_partial_path
=> "aktien/aktie"

不幸的是

<%= render @basiswert.aktie if @basiswert.aktie.present? %>

因以下错误而失败

ActionView::Template::Error ('["id", 134]' is not an ActiveModel-compatible object. It must implement :to_partial_path.)

有什么建议可以解决这个问题?

编辑:

进一步调查显示,可以渲染集合, 即

<%= render [@basiswert.aktie] %>

正确呈现视图。渲染普通对象仍然失败,并显示上面显示的错误消息。

0 个答案:

没有答案
相关问题