Sha256: 6a8a6d3fb770d1f13830a3751f5cf396779337cab70dc27d22e4bc5a5e97727d

Contents?: true

Size: 673 Bytes

Versions: 32

Compression:

Stored size: 673 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_attributes!(l) if content_type
    when "two_dimensional_moving_image"
      content_type = ContentType.where(name: 'video').first
      content_type.update_attributes!(l) if content_type
    end

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

Version data entries

32 entries across 31 versions & 2 rubygems

Version Path
enju_biblio-0.2.5 lib/tasks/content_type.rb
enju_biblio-0.2.4 lib/tasks/content_type.rb
enju_biblio-0.2.3 lib/tasks/content_type.rb
enju_biblio-0.2.2 lib/tasks/content_type.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.1/lib/tasks/content_type.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.0/lib/tasks/content_type.rb
enju_biblio-0.2.1 lib/tasks/content_type.rb
enju_biblio-0.2.0 lib/tasks/content_type.rb
enju_biblio-0.2.0.beta.4 lib/tasks/content_type.rb
enju_biblio-0.2.0.beta.3 lib/tasks/content_type.rb
enju_biblio-0.2.0.beta.2 lib/tasks/content_type.rb
enju_biblio-0.2.0.beta.1 lib/tasks/content_type.rb
enju_biblio-0.1.3 lib/tasks/content_type.rb
enju_biblio-0.1.2 lib/tasks/content_type.rb
enju_biblio-0.1.1 lib/tasks/content_type.rb
enju_biblio-0.1.0 lib/tasks/content_type.rb
enju_biblio-0.1.0.pre71 lib/tasks/content_type.rb
enju_biblio-0.1.0.pre70 lib/tasks/content_type.rb
enju_biblio-0.1.0.pre69 lib/tasks/content_type.rb
enju_biblio-0.1.0.pre68 lib/tasks/content_type.rb