Fix ActiveRecord calls in FolderNode
Fix some ActiveRecord queries