我正在使用thinking sphinx,带有sphinx_select 参数来创建一个动态字段,如下所示:
@subjects = Subject.search(sphinx_select: "*, petals < 1 or color = 2 as my_attribute")
有没有办法custom_attribute
在搜索结果中访问?例如:
@subjects.each do |s|
s.my_attribute
end
退货
undefined method `my_attribute' for #<Subject:0x007fb25cdcdb18>