我试图制作一个新的Devise模型“User”,但我不能。我的服务器也不会加载。我一直收到错误:“未初始化的常量用户”。
这是我试过的:
bundle install
,bundle update
和gem pristine --all
require 'devise'
添加到我的application.rb rails g devise:install
这是我的宝石文件:
source 'https://rubygems.org'
gem 'rails', '4.2.6'
gem 'pg', '~> 0.15'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bootstrap-sass', '~> 3.3.6'
gem 'rails_12factor'
gem "figaro"
gem 'devise'
gem 'paperclip', github: 'thoughtbot/paperclip'
group :development, :test do
gem 'byebug'
gem 'sqlite3'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
堆栈追踪:
WARNING: Nokogiri was built against LibXML version 2.9.4, but has dynamically loaded 2.9.2
/Users/Sam/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:261:in `const_get': uninitialized constant User (NameError)
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:261:in `block in constantize'
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in `each'
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in `inject'
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.6/lib/active_support/inflector/methods.rb:259:in `constantize'
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/devise-4.1.1/lib/devise.rb:289:in `get'
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/devise-4.1.1/lib/devise/mapping.rb:81:in `to'
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/devise-4.1.1/lib/devise/mapping.rb:76:in `modules'
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/devise-4.1.1/lib/devise/mapping.rb:93:in `routes'
from /Users/Sam/.rvm/gems/ruby-2.2.1/gems/devise-4.1.1/lib/devise/mapping.rb:160:in `default_used_route'
我不确定发生了什么。
答案 0 :(得分:3)
您是否制作了模型?
rails generate devise User