我正在与Resque合作,但我的所有工作人员都在给我ActiveRecord :: RecordNotFound错误。是否存在某种设置错误。我做了相关部分来加载Rails环境。 https://github.com/resque/resque/wiki/FAQ#how-do-i-ensure-my-rails-classesenvironment-is-loaded但我仍然遇到这些错误。
Database.yml:
development:
adapter: postgresql
encoding: unicode
database: app_development
pool: 19
username: <%= ENV['POSTGRES_USERNAME'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>
host: localhost
test:
adapter: postgresql
encoding: unicode
database: app_test
pool: 19
username: <%= ENV['POSTGRES_USERNAME'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>
host: localhost
Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
group :development, :test do
gem 'dotenv-rails'
end
gem 'rails', '3.2.18'
gem 'pg'
gem 'jquery-rails'
gem 'haml'
gem 'will_paginate', '>= 3.0.2'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'redis'
gem 'sinatra', '>= 1.3.0'
gem 'resque', :require => "resque/server"
# Use unicorn as the web server
#gem 'unicorn'
gem 'puma', '~> 2.8.2'
gem 'rack-timeout' #threaded abort requests that are taking too long...
gem 'memcachier'
gem 'dalli'
gem 'gritter'
gem 'client_side_validations', :git => 'git://github.com/bcardarella/client_side_validations.git', :branch => '3-2-stable'
gem 'strong_parameters', '>= 0.1.4', :git => 'git://github.com/rails/strong_parameters.git'
gem 'recaptcha', :require => 'recaptcha/rails'
gem 'acts_as_tree'
gem 'acts_as_list'
gem 'foreigner'
gem 'hpricot'
gem 'roadie'
#gem 'premailer-rails3'
gem 'chronic'
gem 'ransack', :git => 'git://github.com/markysharky70/ransack.git'
gem 'mini_magick'
#gem 'rmagick'
gem 'rqrcode'
gem 'imgkit'
gem 'carrierwave'
gem 'fog'
gem 'carrierwave_direct'
gem 'right_aws'
gem 'jquery-fileupload-rails'
gem 'authorize_net', '1.5.2', :git => 'git://github.com/markysharky70/authorize_net'
gem 'detect_timezone_rails'
gem 'figaro'
gem 'wicked'
gem 'heroku-api'
gem 'ar_after_transaction'
gem 'browser'
gem 'social-share-button'
gem 'auto_strip_attributes', '~> 1.0'
gem 'jquery_datepicker'
gem 'jwt'
gem 'zendesk_api'
gem 'acts-as-taggable-on'
gem 'geokit-rails', '~> 2.0.1'
gem 'activerecord-postgres-hstore'
gem 's3_swf_upload', :git => 'git://github.com/nathancolgate/s3-swf-upload-plugin'
gem 'airbrake'
group :production, :staging do
gem 'rails_12factor'
gem 'newrelic_rpm'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
group :development, :test do
gem 'rails3-generators'
gem 'haml-rails'
gem 'ruby_parser'
#gem 'ruby-debug19', :require => 'ruby-debug'
gem 'debugger-ruby_core_source'
gem 'debugger'
#gem 'byebug'
gem 'therubyracer'
gem 'rspec-rails'
#gem 'capybara'
gem 'capybara-puma'
gem 'selenium-webdriver', '~> 2.40.0'
gem 'rubyzip', '~> 1.0'
gem 'launchy'
gem 'database_cleaner'
gem 'rubygems-bundler'
gem 'bullet'
gem 'capybara-screenshot'
gem 'quiet_assets'
gem 'guard-livereload', :require => false
gem 'rb-fsevent'
end
group :test do
gem 'factory_girl_rails'
gem 'guard-rspec'
gem 'spork', '>= 1.0.0.rc2'
gem 'guard-spork'
gem "timecop"
gem "flexmock"
gem "resque_spec"
gem "show_me_the_cookies"
gem 'shoulda-matchers'
end
group :development do
gem 'annotate'
gem 'rb-inotify', '~> 0.8.8', :require => false
gem 'hirb'
gem 'rack-mini-profiler'
gem 'webrick', '1.3.1'
end
答案 0 :(得分:1)
在维护项目的人的帮助下,我发现我已经在全球范围内导出了另一个项目的一些环境变量,尤其是DATABASE_URL,这导致了这个问题。