Questions tagged [uninitialized-constant]

104 questions
1
vote
1 answer

NameError (uninitialized constant Error) in Rails 7

I recently upgraded my rails application to rails 7 and after upgrading when I try to call the call from the lib folder I am getting this error NameError (uninitialized constant Error) I have following file structure in the lib folder lib -> a ->…
1
vote
1 answer

Ruby on rails: model name uninitialized error (mismatch of module)

I am accessing model Company::Item in controller Security::MyController. It is giving error uninitialised constant Security::Company::Item . So basically it is appending 'Security::' for given model. It is not the case with some other models say…
1
vote
1 answer

Error after attempting to link_to partials

Using this previous question as a guide, I've attempted to create a ul navigation header above a container that renders partials within the container when clicked. (Hopefully that makes some sense, but it may not be important.) Until the links for…
tvalent2
  • 4,959
  • 10
  • 45
  • 87
1
vote
2 answers

Rails 3 uninitialized constant ... (NameError) in custom initializer

I'm trying to implement the contact form described here. I get the following error when I run rails server: /home/user/project/web/config/initializers/app_config.rb:11:in `': uninitialized constant RailsContactForm (NameError) from…
1
vote
2 answers

Concatenating strings in C: string buffer is not getting cleared after function call

I am trying to concat two strings in the function foo(). I expect the content of string to be abc after both the first and second calls to foo(). The output which I get after the first call is abc but the second call prints abcabc (the third call…
mcgusty
  • 1,354
  • 15
  • 21
1
vote
0 answers

Uninitialized constant 'ActionView' / Don't know how to build task 'environment' in rake task

So, I have actually two issues, but I bet they are connected to each other. I have to call a rake task on a legacy app (also the task is legacy) but run into "Don't know how to build task 'environment'" and "uninitilized constant" errors. We're…
1
vote
3 answers

NameError: uninitialized constant #::Searchable

While debugging an unrelated issue in rspec, I'm coming across issues with constant loading. The setup is as follows: # app/models/foo.rb class Foo << ApplicationRecord include Foo::Searchable end # app/models/foo/searchable.rb module…
zach
  • 319
  • 1
  • 11
1
vote
0 answers

Chef : NameError : Uninitialized constant curstom resource

error Can someone tell me what can be the causes of this error. Does this mean it needs initialization before actually using it? My resource uses REXML::Element where it is throwing error, although the values have been supplied it is throwing…
1
vote
1 answer

Rails: uninitialized constant Controller

Here is my setup: Routes: resources :apps, except: [:index, :new], path: 'a' do resources :platforms, only: [:update] end Controller: class Apps::PlatformsController < ApplicationController before_action :authenticate_user! …
heroxav
  • 1,387
  • 1
  • 22
  • 65
1
vote
1 answer

Rails: NameError uninitialized constant on Database Relationship

I have a model called "cube," which represents a collection of trading cards: app/models/cube.rb class Cube < ApplicationRecord has_many :cubecards validates :name, length: { in: 3..30 } end As you can see, this model has a has_many…
1
vote
0 answers

Rails getting uninitialized constant error when trying to instantiate class from module in controller

I created a module with some utility classes. A class from this module is instantiated from one of my controller several times : class Admin::Statistic::StatisticsController < Admin::Statistic::ApplicationController def index …
David Geismar
  • 3,152
  • 6
  • 41
  • 80
1
vote
2 answers

rake db:migrate cause StandardError - uninitialized constant CreateObjects::Object

I have migration 20150930051523_create_objects.rb: class CreateObjects < ActiveRecord::Migration def change create_table :objects do |t| t.text :name t.timestamps null: false end Object.create :name => "A" Object.create :name =>…
irishfromua
  • 11
  • 1
  • 3
1
vote
1 answer

Thinking Sphinx 3.1 NameError: uninitialized constant in production mode

A have project on rails 3.2.17 with db MySQL. Use Thinking Sphinx 3.1. And I have only two models in index: Group and Product. In development mode everything works perfectly, even on production server. I created development db on production server…
1
vote
1 answer

NameError (uninitialized constant HomesController::Indirizzo): Heroku

I've deployed my app to Heroku and am getting the the following error: v2014-08-29T01:59:06.582118+00:00 app[web.1]: NameError (uninitialized constant HomesController::Indirizzo): I am using the Indirizzo gem and it's showing as being install on…
1
vote
1 answer

Can you declare a constant object in a function?

One semester of Comp Sci under my belt, here goes nothing. I need to call a constant int to use for the number of LEDs are in a strip for FastLED. Long story short, I'm trying to replace... #include "FastLED.h" #define NUM_LEDS_RT 174 …
Retro
  • 11
  • 4