Cloudinary未初始化的常量Cloudinary :: Uploader :: Base

时间:2016-08-18 01:18:50

标签: ruby-on-rails carrierwave cloudinary

我无法通过Carrierwave在我的应用中使用Cloudinary。我发现Cloudinary和Heroku的文档都是模糊不清的,经过大量搜索我发现this非常有帮助,但现在我的应用程序崩溃了这个错误:

 NameError in SiteController#index
uninitialized constant Cloudinary::Uploader::Base 

我的photo_uploader.rb看起来像这样:

class PhotoUploader < CarrierWave::Uploader::Base
  include Cloudinary::Carrierwave


end

professor.rb

require 'elasticsearch/model'
class Professor < ActiveRecord::Base
  attr_accessor :photo
  mount_uploader :photo, PhotoUploader

视图如下:

  <legend>Photo</legend>
  <%= f.file_field :photo %>

的Gemfile:

来源&#39; https://rubygems.org&#39;

ruby '2.3.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
#bcrypt for for encrpytion
gem 'bcrypt', '~> 3.1', '>= 3.1.11'
#byebug
gem 'byebug', '~> 9.0', '>= 9.0.5'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
#paperclip for easy upload management
gem 'paperclip', '~> 4.3', '>= 4.3.6'
#bootstrap-sass
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
#searchkick
gem 'searchkick', '~> 1.2', '>= 1.2.1'
#paginate
gem 'will_paginate', '~> 3.1'
#paginate for bootstrap
gem 'bootstrap-will_paginate', '~> 0.0.10'
#rmagick
gem 'rmagick', '~> 2.15', '>= 2.15.4'
#Carrierwave
gem 'carrierwave'
#Cloudinary
gem 'cloudinary'
#attachinary
gem 'attachinary', '~> 1.3', '>= 1.3.1'
#Paperclip forcloudinary
gem 'paperclip-cloudinary'
#elasticsearch stuff
gem 'elasticsearch-rails'
gem 'elasticsearch-model'
#bonsi
gem 'bonsai-elasticsearch-rails', '~> 0.0.4'

group :production do
  gem 'rails_12factor'
  gem 'puma', '~> 3.4'
  gem 'pg'
end


group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'

  gem 'sqlite3'

end

0 个答案:

没有答案