Olá gente, tenho uma aplicação construida em Ruby on Rails e estou com um problema ao deletar. O seguinte log é gravado com o erro:
ActiveRecord::StatementInvalid (TinyTds::Error: Incorrect syntax near ','.: EXEC sp_executesql N' SELECT distinct parent.*, LEN(parent.path) - LEN(REPLACE( parent.path,''.'','''')) level,
tc.active,
IIF(EXISTS(
SELECT * FROM impasse_test_plan_cases AS tpc WHERE tpc.test_case _id = parent.id
),1,0)
AS planned
FROM impasse_nodes AS parent
JOIN impasse_nodes AS child
ON parent.path = SUBSTRING(child.path, 1, LEN(parent.path))
LEFT JOIN impasse_test_cases AS tc
ON child.id = tc.id
WHERE parent.path LIKE N''.14582.14292.%''
ORDER BY level DESC
'):
Este é o método para remover:
[code]def destroy
params[:node][:id].each do |id|
node = Impasse::Node.find(id)
inactive_cases = []
ActiveRecord::Base.transaction do
node.all_decendant_cases_with_plan.each do |child|
if child.planned?
Impasse::TestCase.update_all({:active => false}, ["id=?", child.id])
inactive_cases << child
else
case child.node_type_id
when 2
if inactive_cases.all? {|ic| ! ic.path.start_with? child.path}
Impasse::TestSuite.delete(id)
child.destroy
end
when 3
Impasse::TestCase.delete(child.id)
child.destroy
end
end
end
end
end
render :json => {:status => true}
end[/code]
Obrigada!!