如何修复控制器中未初始化的常量
How to fix Uninitialized Constant in Controller
我得到一个:
uninitialized constant ProfilesController::EUserPofile
尝试时出错:
class ProfilesController < ApplicationController
def index
#@profiles = EUserProfile.all
end
def preview
@profiles = EUserPofile.all
end
end
它在索引时工作正常,但在预览时会崩溃。
这是我的路线文件:
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
有一个错字:EUserPofile
-> EUserProfile
我得到一个:
uninitialized constant ProfilesController::EUserPofile
尝试时出错:
class ProfilesController < ApplicationController
def index
#@profiles = EUserProfile.all
end
def preview
@profiles = EUserPofile.all
end
end
它在索引时工作正常,但在预览时会崩溃。
这是我的路线文件:
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
有一个错字:EUserPofile
-> EUserProfile