0
我有两个不同页的两个查询时获得的ActiveRecord只读错误。对于第一个查询,一切都很好。我这样做与第一个查询:添加where子句
a = all_teams.first.term_enrollments.first
a.update_attributes term: Term.find(2)
=> true
当我尝试这样做与第二个查询,它不起作用。下面是我尝试第二次查询做代码:
a = current_teams.first.term_enrollments.first
a.update_attributes term: Term.find(2)
但不是工作,它说:
ActiveRecord::ReadOnlyRecord: TermEnrollment is marked as readonly
这些查询的两个都在控制器动作和饲料,通过ActiveRecord的循环页关系并显示每个实例的编辑表单。