如何在Controller中修复未初始化的常量

时间:2016-10-17 21:48:34

标签: ruby-on-rails ruby ruby-on-rails-5

我得到了:

  

未初始化的常量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

1 个答案:

答案 0 :(得分:0)

有一个拼写错误:EUserPofile - &gt; EUserProfile

相关问题