2016-09-19 80 views
0

我注意到,在Heroku中使用滑軌控制檯時我有雙重查詢。我之前沒有看到這個問題。任何想法可能導致它?在使用Heroku時在滑軌控制檯中的雙查詢

我已經閱讀this topic,但它沒有解決我的問題。

[email protected]:~/ror/angipl$ heroku run rails c 
Running rails c on ⬢ angipl... up, run.3439 
Loading production environment (Rails 4.2.6) 
irb(main):001:0> Word.find(1) 
    Word Load (0.8ms) SELECT "words".* FROM "words" WHERE "words"."id" = $1 LIMIT 1 [["id", 1]] 
    Word Load (0.8ms) SELECT "words".* FROM "words" WHERE "words"."id" = $1 LIMIT 1 [["id", 1]] 
=> #<Word id: 1, en: "academic", pl: "pracownik naukowy", user_id: 1, created_at: "2016-09-18 07:17:02", updated_at: "2016-09-18 12:05:51", good_count: 4, bad_count: 1, verified: true> 
irb(main):002:0> 

我的Gemfile:

source 'https://rubygems.org' 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.2.6' 
# Use sqlite3 as the database for Active Record 
group :development, :test do 
    gem 'sqlite3' 
end 
group :production do 
    gem 'pg', '~> 0.18.4' 
end 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0', group: :doc 

# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 


gem 'haml', '~> 4.0.5' 
gem "haml-rails", "~> 0.9" 
gem 'bootstrap-sass', '~> 3.3.6' 
gem 'sass-rails', '>= 3.2' 
gem 'devise' 
gem 'simple_form' 
gem 'jquery-turbolinks' 
gem 'active_link_to' 
# gem 'commontator', '~> 4.11.1' 
gem 'devise-i18n' 
gem 'acts_as_votable', '~> 0.10.0' 
gem 'will_paginate', '~> 3.1.0' 
gem 'will_paginate-bootstrap' 
gem 'rails_admin' 
gem 'cancancan', '~> 1.10' 
gem "paperclip", "~> 5.0.0" 
gem 'draper', '~> 2.1' 
gem 'decent_exposure', '~> 2.3', '>= 2.3.3' 
gem 'decent_decoration', '~> 0.0.6' 
gem 'faker', '~> 1.6', '>= 1.6.3' 
gem 'react-rails' 

group :development, :test do 
    gem 'rspec-rails', '~> 3.4' 
    gem 'byebug' 
    gem 'factory_girl_rails' 
    gem 'spring' 
    gem 'web-console', '~> 2.0' 
    gem "better_errors" 
    gem 'capybara' 
end 

group :production do 
    gem 'puma' 
    gem 'rails_12factor' 
    gem 'web-console', '~> 2.0' 
end 

group :test do 
    gem 'database_cleaner' 
    gem 'shoulda-matchers', '~> 3.1', '>= 3.1.1' 
    gem 'launchy' 
    gem 'selenium-webdriver' 
    gem 'simplecov', :require => false 
end 
+1

您是否在rails_stdout_logging GitHub倉庫中看到過[此問題](https://github.com/heroku/rails_stdout_logging/issues/1)? – pdoherty926

+0

是的。我做了,但我沒有找到解決方案,我的軌道控制檯問題。 –

回答

1

在評論這基本上有一個答案已經here Heroku的問題頁面上引用。

但只是總結它:

兩個SQL查詢並沒有實際發生。這只是記錄器打印兩行的問題。

除去重複信息的方式是該行添加到Procfile(它告訴Heroku上如何運行的應用程序的文件):

web: rackup -p $PORT 

這使得應用程序開始rackup而不是rails server

如果這不起作用,請參閱問題主題以獲取更多建議。

+0

我在應用程序的根目錄下創建了名爲'Procfile'的文件。它沒有幫助。 –