我需要在我的 wicegrid 中显示一个虚拟属性 :status 但我总是得到错误 :status 不在数据库中....当然不是,它是虚拟的!
有没有办法让一列包含虚拟属性?如果是,我怎样才能有一个自定义过滤器?
该模型
class Shop < ActiveRecord::Base
attr_accessor :status
end
在视图中
<%= grid(@grid, upper_pagination_panel: false) do |g|
g.column name: "Status", attribute: "status"
<% end %>