我从postgres切换到mysql数据库并收到错误

时间:2015-04-29 01:58:43

标签: mysql ruby postgresql ruby-on-rails-4 mysql2

将所有应用程序文件复制到新的app文件夹并通过自制程序安装MySQL后,我在尝试查看网站时收到此错误消息。

AbstractController::Helpers::MissingHelperError in WelcomeController#index
Missing helper file helpers//users/froy_terriquez/desktop/projects/ram/app/helpers/application_helper.rb_helper.rb
          class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
Rails.root: /Users/FroyTerriquez/Desktop/projects/ram
Application Trace | Framework Trace | Full Trace
app/controllers/application_controller.rb:1:in `<top (required)>'
app/controllers/welcome_controller.rb:1:in `<top (required)>'

欢迎控制器:

    class WelcomeController < ApplicationController
include ApplicationHelper

  def index
  end

  def contact
  end

  def about
  end
end

应用程序控制器:

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.


  protect_from_forgery with: :exception
end

两位助手:

module ApplicationHelper

end

module WelcomeHelper


end

非常感谢任何帮助。

另外,如果您知道任何信息性链接,可以让我知道在rails项目中切换数据库的正确过程是什么!

1 个答案:

答案 0 :(得分:0)

编辑您的database.yml文件以反映您的新数据库设置:

例如:

 development:
  adapter: mysql2
  encoding: utf8
  database: my_app_development
  pool: 5
  username: root
  password:

 test:
  adapter: mysql2
  encoding: utf8
  database: my_app_test
  pool: 5
  username: root
  password:


 production:
  adapter: mysql2
  encoding: utf8
  database: ymca_gym_production
  pool: 5
  username: root
  password: