2
Per the upgrade notes,我已經添加了app/models/application_record.rb
文件,內容如下:的Rails找不到ApplicationRecord到Rails 5
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
但是當我嘗試運行bin/rails s
,我看到以下錯誤:
active_record/dynamic_matchers.rb:21:in `method_missing': undefined local variable or method ` self' for ApplicationRecord(Table doesn't exist):Class (NameError)
看起來好像軌找不到application_record.rb
文件,但我重裝春天,也試圖運行rails s
(不斌)。但總是一樣的錯誤。
我在Mac上運行ruby 2.3。
這裏是我的Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.0'
gem 'mysql2', '~> 0.3.18'
gem 'bootstrap-sass', '~> 3.3.5'
gem 'sass-rails', '~> 5.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.5'
gem 'sdoc', '~> 0.4.0', group: :doc
#translations
gem 'rails-i18n'
gem 'i18n-active_record',
:git => 'git://github.com/svenfuchs/i18n-active_record.git',
:require => 'i18n/active_record'
gem 'geocoder'
gem 'globalize', github: 'globalize/globalize'
gem 'sunspot_rails'
gem 'globalize-accessors'
gem 'haml-rails'
gem 'slim-rails'
gem 'simple_form'
gem 'font-awesome-sass', '~> 4.4.0'
gem 'country_select'
gem 'friendly_id'
gem 'ckeditor'
gem 'carrierwave'
gem 'mini_magick'
gem 'fog'
gem 'fog-aws'
gem 'devise'
gem 'devise_invitable'
gem 'pundit'
gem 'mail'
gem 'recaptcha', :require => 'recaptcha/rails'
gem 'roadie-rails', '~> 1.0'
gem 'sitemap_generator'
gem 'will_paginate'
gem 'dumper'
group :development do
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'sunspot_solr'
gem 'progress_bar'
gem 'letter_opener'
gem 'spring'
gem 'better_errors'
gem 'mina'
end
group :development, :test do
gem 'rspec-rails'
gem 'byebug'
gem 'binding_of_caller'
gem 'factory_girl_rails'
gem 'faker'
gem 'launchy'
end
group :test do
gem 'poltergeist'
gem 'capybara'
gem 'database_cleaner'
end
什麼這裏給?
如果你用'bundle exec rails s'運行它,會發生什麼?另外,你能告訴我們你的'Gemfile'嗎? – Wikiti
@Wikiti - 相同的結果 – croceldon
從手冊開始,唯一的問題可能是在'rails app:update'合併期間。傻,問,但我認爲'rails -v'和'ruby -v'給你正確的版本?在rails版本升級期間出現任何錯誤 – 2016-07-05 19:07:42