因为对sidekiq研究不透,当时并没有注意 :queues 这块的含义. 在反复google后终于在这篇教程里找到了问题的原因所在. 其中有这样一句话,让我恍然大悟: “!!! important. You may need to include new queue names in sidekiq.yml file:” 我了个大艹! 原来是我没有把 development_mailers 队列加到可执行队列中去. 添加后的sidekiq.yml配置项是这样的
# Defines the matching rules for Guard. guard :minitest, spring:true, all_on_start:falsedo watch(%r{^test/(.*)/?(.*)_test\.rb$}) watch('test/test_helper.rb') { 'test' } watch('config/routes.rb') { integration_tests } watch(%r{^app/models/(.*?)\.rb$}) do|matches| "test/models/#{matches[1]}_test.rb" end watch(%r{^app/controllers/(.*?)_controller\.rb$}) do|matches| resource_tests(matches[1]) end watch(%r{^app/views/([^/]*?)/.*\.html\.erb$}) do|matches| ["test/controllers/#{matches[1]}_controller_test.rb"] + integration_tests(matches[1]) end watch(%r{^app/helpers/(.*?)_helper\.rb$}) do|matches| integration_tests(matches[1]) end watch('app/views/layouts/application.html.erb') do 'test/integration/site_layout_test.rb' end watch('app/helpers/sessions_helper.rb') do integration_tests << 'test/helpers/sessions_helper_test.rb' end watch('app/controllers/sessions_controller.rb') do ['test/controllers/sessions_controller_test.rb','test/integration/users_login_test.rb'] end watch('app/controllers/account_activations_controller.rb') do'test/integration/users_signup_test.rb' end watch(%r{app/views/users/*}) do resource_tests('users') + ['test/integration/microposts_interface_test.rb'] end end
# Returns the integration tests corresponding to the given resource. defintegration_tests(resource = :all)if resource == :all Dir["test/integration/*"] else Dir["test/integration/#{resource}_*.rb"] end end
# Returns the controller tests corresponding to the given resource. defcontroller_test(resource)"test/controllers/#{resource}_controller_test.rb" end # Returns all tests for the given resource. defresource_tests(resource) integration_tests(resource) << controller_test(resource) end #下面这行会让 Guard 使用 Rails 提供的 Spring 服务器减少加载时间,而且启动时不运行整个测试组件。 guard :minitest, spring:true, all_on_start:falsedo #使用 Guard 时,为了避免 Spring 和 Git 发生冲突,应该把 spring/ 文件夹加到 .gitignore 文件中,让 Git 忽 略这个文件夹。
<div> <% debug(params) if Rails.env.development? % > </div>
在指定的环境下执行命令
1 2 3 4
rails console test #在test环境下启用rails console rails server --enviroment production #在production环境下运行服务 rails db:migrate RAILS_ENV=production #迁移production环境数据库 #控制台,服务器,迁移命令 这几个命令中都可以使用RAILS_ENV=<env>,比如: RAILS_ENV=production rails server
hexo s [Error: Module did not self-register.] { [Error: Cannot find module './build/default/DTraceProviderBindings'] code:'MODULE_NOT_FOUND' } { [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code:'MODULE_NOT_FOUND' } INFO Start processing INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.