【问题标题】:I switched from postgres to a mysql database and get an error我从 postgres 切换到 mysql 数据库并收到错误
【发布时间】:2015-04-29 01:58:43
【问题描述】:

将所有应用程序文件复制到新的应用程序文件夹并通过自制软件安装 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 项目中切换数据库的正确过程是什么,那将是很棒的!

【问题讨论】:

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


    【解决方案1】:

    编辑您的 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:
    

    【讨论】:

      猜你喜欢
      • 2017-05-03
      • 1970-01-01
      • 2018-11-02
      • 2020-09-28
      • 1970-01-01
      • 1970-01-01
      • 2021-04-20
      • 2020-10-12
      • 2018-12-11
      相关资源
      最近更新 更多