Dr Swerve Dr Swerve - 1 month ago 13
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
end

def preview
@profiles = EUserPofile.all
end

end


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
end

end

Answer

There's a typo: EUserPofile -> EUserProfile