我有一个带有问题和答案的rails应用程序,每个答案都有一个等级取决于某些参数,如示例 注意:我不想要从1到10的星号方面,所以我可以稍后对所有字段进行加权平均并进行计算。 如何使用write属性来获取数据? 错误:SystemStackError:堆栈级别太深
def set_price_rating
# set_price = 5
puts case price_today
when 1..21 then
"0".to_i
when 22..29 then
"5".to_i
when 30..39 then
"7".to_i
when 40..49 then
"8".to_i
when 50..59 then
"6".to_i
else
"0".to_i
end
write_attribute(:price_rating, set_price_rating)
save
end