gpt4 book ai didi

mysql - 当我运行 rake db :seed, 时,我不断收到 "rake aborted! ActionView::Template::Error: Missing host to link to! "

转载 作者:行者123 更新时间:2023-11-30 22:04:59 25 4
gpt4 key购买 nike

我正在尝试在本地主机上运行我们公司的产品源代码。我试过放置

config.action_mailer.default_url_options = { host: "localhost:3000" }

在所有 development.rb、test.rb 和 production.rb 中。但是当我跑的时候

rake db:seed  

我还在坚持

ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true.

我正在按照编辑中的建议添加我的 config/database.yml 文件配置/数据库.yml

default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password: ******
socket: /var/run/mysqld/mysqld.sock

development:
<<: *default
database: company_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: coompany_test

# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
#
# You can use this database configuration with:
#
# production:
# url: <%= ENV['DATABASE_URL'] %>
#
production:
<<: *default
database: company_production
username: company
password: <%= ****** %>

任何帮助将不胜感激。谢谢。

最佳答案

我猜你正试图用种子填充开发环境,如果是这样的话试试这个

rake db:seed RAILS_ENV=development

关于mysql - 当我运行 rake db :seed, 时,我不断收到 "rake aborted! ActionView::Template::Error: Missing host to link to! ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42106175/

25 4 0