uninitialized constant Car::PictureUploader

Related searches

I'm trying to add a Picture Uploader in app/uploaders but am getting this error when loading my app:

uninitialized constant Car::PictureUploader on line 3 of car.rb

app/models/car.rb

class Car < ActiveRecord::Base
  belongs_to :user
  mount_uploader :picture, PictureUploader
  validates :user_id, presence: true
  validates :year, presence:true, length: { maximum: 4 }
  validates :brand, presence:true

app/uploaders/picture_uploader.rb

class PictureUploader < CarrierWave::Uploader::Base
  storage :file

  # 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

  # Add a white list of extensions which are allowed to be uploaded.
  def extension_white_list
    %w(jpg jpeg gif png)
  end
end

I've gotten this error before when the file equivalent to picture_uploader.rb wasn't in the correct folder, but I think everything is in order here. When I comment out line 3 in user.rb the page loads. Any idea on how I can get my page to run?

I think you want:

::PictureUploader

Which specifies that it's just the class PictureUploader not a class PictureUploader within the namespace Car.

ameError: uninitialized constant Img::ImageUploader in console only , new I receive NameError: uninitialized constant Img::ImageUploader , yet this works from the browser. config/initializers/shrine.rb require "shrine"� To troubleshoot your code, examine it for the possible causes listed above one at a time. If you find a problem, address it. For example, go through the code looking for a discrepancy in uppercase and lowercase usage on variables and classes.

Had the same error and had to manually kill the server process:

ps aux | grep server
kill [server process id]

For some reason shutting down the server with Ctrl+C earlier didn't seem to have worked.

NameError: uninitialized constant SomeModel::FooUploader � Issue , The Ruby NameError: Uninitialized Constant error has several causes. Learn what they NameError: uninitialized constant Object::Something. We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand

Just restart your server. It'll fix the issue. Everything is ok in your code.

The Ruby NameError: Uninitialized Constant Error, NameError: uninitialized constant Mysql2::Client::SECURE_CONNECTION Dec Checkout rails/rails#13247 Auto-suggest helps you quickly narrow down your uninitialized constant Article::PictureUploader (NameError) Tag: ruby-on-rails� Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

Nameerror uninitialized constant create, NameError: uninitialized constant ActiveModel::Serializers::Xml in uninitialized constant Article::PictureUploader (NameError) Tag: ruby-on-rails I'm writing a D : Andrew Marshall has an excellent point about the auto-load setup (see the� Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

Ruby uninitialized constant module, this was I how I unlocked my car radio on my Toyota Corolla (2010 model). Save yourself $70 dollars and do it yourself: Place the ignition switch to “ACC” position and make su

This banner text can have markup.. web; books; video; audio; software; images; Toggle navigation

Comments
  • Did you restart your server?