Skip to content
Snippets Groups Projects
Commit 01efb60e authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

Merge branch 'feature-object-type-task' into 'master'


creating task to restart object type table

Signed-off-by: default avatarman13 <man13@inf.ufpr.br>

See merge request !178
parents 2bb5c358 27e2ecf8
No related branches found
No related tags found
No related merge requests found
namespace :object_type do
desc 'Destroy the types that are not defaults'
task :restart => :environment do
undefined_type = ObjectType.find_by_name('Outros')
ObjectType.all.each do |type|
unless default_types.include? type.name
type.learning_objects.each {|lo| lo.update_attribute(:object_type, undefined_type) }
ObjectType.destroy type.id
end
end
end
def default_types
[
'Imagem', 'Mapa', 'Software Educacional', 'Experimento prático', 'Animação/simulação', 'Texto',
'Áudio', 'PDF', 'Website externo', 'Vídeo', 'Outros'
]
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment