Ruby on rails 通过管理面板更改选项的位置
我有一个下面的方法,这是重新安排的电台和我的应用程序复选框图像的位置Ruby on rails 通过管理面板更改选项的位置,ruby-on-rails,model,ancestry,Ruby On Rails,Model,Ancestry,我有一个下面的方法,这是重新安排的电台和我的应用程序复选框图像的位置 def change_position if !self.position.blank? existing_model=Part.where("ancestry = #{self.ancestry} and position = #{self.position}") if !existing_model[0].blank? if !self.changes['position'].blank? exis
def change_position
if !self.position.blank?
existing_model=Part.where("ancestry = #{self.ancestry} and position = #{self.position}")
if !existing_model[0].blank?
if !self.changes['position'].blank?
existing_model[0].update_columns(position: self.changes['position'][0])
end
end
end
end
但当我试图更改父选项的位置时,我在rails管理面板中发现了以下错误
SQLite3::SQLException:near and:syntax error:SELECT parts.*从祖先=和位置=2的零件中,按ASC处创建的顺序
为什么我不能在此处保存父选项位置的位置
有什么帮助吗?问题似乎出在where子句中。也许赛尔夫的故事是固定的。那只是因为。。谢谢