我正在尝试在本地主机上运行我们公司的产品源代码。我试过放置
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文件 配置/ database.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: <%= ****** %>
非常感谢任何帮助。谢谢。
答案 0 :(得分:0)
我猜你试图用种子填充开发环境,如果是这种情况,那么试试这个
rake db:seed RAILS_ENV=development
答案 1 :(得分:0)
我明白了。我忘了回答抱歉。解决方案可能因每个人的特定错误而异。但对我来说,我必须在以下文件中进行以下更改。
在application.yml中我添加了
SMTP_HOST: 'localhost:3000'
在development.rb中我添加了
config.action_mailer.raise_delivery_errors = false
播种完成。