Dr Swerve Dr Swerve - 1 year ago 114
Ruby Question

How to fix Uninitialized Constant in Controller

I am getting a:

uninitialized constant ProfilesController::EUserPofile

error when trying to:

class ProfilesController < ApplicationController
def index
#@profiles = EUserProfile.all

def preview
@profiles = EUserPofile.all


it works fine for index but for preview it crashes.

here is my route file:

Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get 'welcome', to: 'pages#home'
get 'profiles', to: 'profiles#index'
get 'login', to: 'login#login'

resources :profiles do
get 'preview', on: :member


Answer Source

There's a typo: EUserPofile -> EUserProfile

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download