Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Requiring "RMagick" is deprecated. Use "rmagick" instead.FactoryGirl

When I create an object via FactoryGirl and Faker, shell show me an error

[1] pry(main)> FactoryGirl.create(:company)
[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead

but when I create object in development db - it's ok

there is factory

  factory :company do
    title Faker::Company.name
    image Faker::Avatar.image("my-own-slug", "200x200")
  end 

how fix?

like image 350
wweare Avatar asked Apr 25 '15 14:04

wweare


3 Answers

This is most certainly dues to CarrierWave when the execution comes to your line image Faker::Avatar.image("my-own-slug", "200x200").

There is an issue on CarrierWave which is closed now and the fix is merged. Either you include the github commit in your GemFile, or you wait for the next gem release.

like image 67
Benj Avatar answered Sep 25 '22 18:09

Benj


First, most people will want to include rmagick in their bundle like this:

gem 'rmagick', require: false

Second, rmagick 2.15.0 was just released. (Find your version with bundle list.) Upgrade the gem to version 2.15.0 with bundle update.

At this point you may still get the error as a pull request to remove it is on github but has not been merged yet.

like image 23
IAmNaN Avatar answered Sep 22 '22 18:09

IAmNaN


This is very late however it might help someone:

gem 'carrierwave', :github => 'satoruk/carrierwave' , :ref => '43179f94d6a4e62f69e812f5082d6447c9138480'
gem 'rmagick', require: false

This should give you the version with rmagick fixed. I am not sure why they don't merge it to the master.

Hope it helps.

like image 44
Mr H Avatar answered Sep 25 '22 18:09

Mr H