manish gupta
manish gupta

Reputation: 83

I am Using mongodb in rails and when use the carrierwave gem this thrown errors

I am using the following commond

gem 'carrierwave'

bundle

rails generate uploader image

mount_uploader :image, ImageUploader

but it gives the errors

NoMethodError in PostsController#index

undefined method `mount_uploader' for Post:Class Extracted source (around line #8):

line #8: mount_uploader :image, ImageUploader

end

Upvotes: 0

Views: 240

Answers (1)

Pragash
Pragash

Reputation: 743

I think your problem is you are using the wrong gem, for mongodb using mongoid ORM you should use the following gem,

gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'

If you install this you problem should get solved.

Upvotes: 0

Related Questions