Pergunta

I have tried to used taglib in rails. I put this code ( see below ) in the controller but got this error "uninitialized constant ActivityObjects::BuildController::TagLib"

    TagLib::FileRef.open(@activity_object.content_tone_url()) do |fileref|
      unless fileref.null?
        tag = fileref.tag
        title = tag.title
        artist = tag.artist
        album = tag.album
        genre = tag.genre
      end
    end 

Any idea how to used taglib in rails?

Foi útil?

Solução

Ok guys I found the problem I forgot to put require 'taglib' for anybody who is newbie like me :)

Outras dicas

Ruby is looking in your current module namespace for the TagLib constant. To ensure it looks at the top level instead, precede with "::", i.e. ::TagLib::FileRef.open ...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top