Reputation: 1754
I'm currently setting up Active_Admin so the user can create an article and can upload a picture to illustrate it, using Carrier Wave (way too much problems with PaperClip).
Everything is working fine until I add my 'article.rb' inside app/admin
I now can't launch the server without getting the following error: undefined method
Include' for ImageUploader:Class (NoMethodError)`, and the error doesn't show up when I delete my file.
Here is my uploader:
class ImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
Include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Create different versions of your uploaded files:
version :thumb do
process resize_to_fit: [250, 0]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_whitelist
%w(jpg jpeg gif png)
end
end
This is the article.rb file inside my admin folder
ActiveAdmin.register Article do
form_for @article, :html => { :multipart => true } do |f|
f.inputs "Article" do
f.input :titre
f.input :contenu
f.input :image, :as => :file
end
f.buttons
end
end
And this is my Gemfile
source 'https://rubygems.org'
#base
gem 'rails', '4.2.5.1'
gem 'mysql2', '>= 0.3.13', '< 0.5'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
#Gems installed after
#Contacts
gem 'simple_form'
gem 'mail'
#Admin
gem 'nokogiri', '1.6.8.rc3'
gem 'activeadmin', github: 'activeadmin'
gem 'formtastic', '~> 3.1', '>= 3.1.3'
gem 'devise'
gem 'carrierwave', '>= 1.0.0.beta', '< 2.0'
gem 'mini_magick'
gem 'friendly_id', '~> 5.1.0'
The controller contains nothing useful since it's only there to display the article.
I think the error is linked to miniMagick since this is the only "include" in my whole project, but still, I need to resize some pictures...
Any help welcomed
Upvotes: 0
Views: 567
Reputation: 924
try this,
include CarrierWave::RMagick
OR
include CarrierWave::MiniMagick
Upvotes: 1