31
votes

Right now I am working on rails 3.0.0. If I run my project in terminal, I get this warning. Please help me.

/usr/share/ruby-rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.0/lib/action_dispatch/http/mime_type.rb:98: warning: already initialized constant PDF

2
You might look in environment.rb to see if you have a PDF mime-type listed twice - ScottJShea
Are you using a PDF library such as Prawn? - Giuseppe
are you using Wicked PDF? github.com/mileszs/wicked_pdf/pull/82 - aaron

2 Answers

62
votes

You might have this in your config/initializers/mime_types.rb file.

Mime::Type.register 'application/pdf', :pdf

It looks like newer versions of rails already registers it.

29
votes

Try using lookup_by_extenstion before defining it.

I have this on my config/initializers/mime_types.rb file.

Mime::Type.register "application/pdf", :pdf unless Mime::Type.lookup_by_extension(:pdf)