Sha256: 689ef27b5f5ab41f2f28b4b04de488ae0c067f249d2fba3b51b16cd13317d955

Contents?: true

Size: 651 Bytes

Versions: 27

Compression:

Stored size: 651 Bytes

Contents

def update_content_type
  content_types = YAML.load(open('db/fixtures/enju_biblio/content_types.yml').read)
  content_types.each do |line|
    l = line[1].select!{|k, v| %w(name display_name note).include?(k)}

    case l["name"]
    when "text"
    when "performed_music"
      content_type = ContentType.where(name: 'audio').first
      content_type.update!(l) if content_type
    when "two_dimensional_moving_image"
      content_type = ContentType.where(name: 'video').first
      content_type.update!(l) if content_type
    end

    content_type = ContentType.where(name: l["name"]).first
    ContentType.create!(l) unless content_type
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
enju_biblio-0.3.18 lib/tasks/content_type.rb
enju_biblio-0.3.17 lib/tasks/content_type.rb
enju_biblio-0.3.16 lib/tasks/content_type.rb
enju_biblio-0.3.15 lib/tasks/content_type.rb
enju_biblio-0.3.14 lib/tasks/content_type.rb
enju_biblio-0.3.13 lib/tasks/content_type.rb
enju_biblio-0.3.12 lib/tasks/content_type.rb
enju_biblio-0.3.11 lib/tasks/content_type.rb
enju_biblio-0.3.10 lib/tasks/content_type.rb
enju_biblio-0.3.10.rc.3 lib/tasks/content_type.rb
enju_biblio-0.3.10.rc.2 lib/tasks/content_type.rb
enju_biblio-0.3.10.rc.1 lib/tasks/content_type.rb
enju_biblio-0.3.9 lib/tasks/content_type.rb
enju_biblio-0.4.0.rc.1 lib/tasks/content_type.rb
enju_biblio-0.3.8 lib/tasks/content_type.rb
enju_biblio-0.3.7 lib/tasks/content_type.rb
enju_biblio-0.3.6 lib/tasks/content_type.rb
enju_biblio-0.4.0.beta.2 lib/tasks/content_type.rb
enju_biblio-0.4.0.beta.1 lib/tasks/content_type.rb
enju_biblio-0.3.5 lib/tasks/content_type.rb