lib/tasks/para_tasks.rake in para-0.6.2 vs lib/tasks/para_tasks.rake in para-0.6.3
- old
+ new
@@ -7,12 +7,12 @@
task singleton_to_form: :environment do
class Para::Component::SingletonResource < Para::Component::Base
end
Para::Component::Base.where(type: 'Para::Component::SingletonResource').pluck(:identifier, :id).each do |identifier, id|
- Para::ComponentResource.where(component_id: id).update_all(
- component_id: Para::Component::Form.find_by_identifier(identifier: identifier).id
- )
+ if (form_component_id = Para::Component::Form.find_by_identifier(identifier).try(:id))
+ Para::ComponentResource.where(component_id: id).update_all(component_id: form_component_id)
+ end
Para::Component::Base.where(id: id).destroy_all
end
end
end