2016-09-12 22 views
0

私は非常に奇妙な問題を抱えています。私は開発したレールアプリケーションを開発環境でうまく開発してテストしましたが、私のサイトを稼動させて運用環境で稼働させるには、rake secretコマンドを実行する必要がありました。残念ながら、私は、次のエラーメッセージが直面している:Rails NoMethodError:未定義メソッド `[] = 'for nil:実稼働環境のNilClass

rake aborted! 
NoMethodError: undefined method `[]=' for nil:NilClass 
/var/www/html/comigo/comigo/config/application.rb:31:in `<class:Application>' 
/var/www/html/comigo/comigo/config/application.rb:19:in `<module:Comigo>' 
/var/www/html/comigo/comigo/config/application.rb:18:in `<top (required)>' 
/var/www/html/comigo/comigo/Rakefile:4:in `require' 
/var/www/html/comigo/comigo/Rakefile:4:in `<top (required)>' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load_rakefile' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:686:in `raw_load_rakefile' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:96:in `block in load_rakefile' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:95:in `load_rakefile' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:79:in `block in run' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:77:in `run' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/exe/rake:27:in `<top (required)>' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/bin/rake:22:in `load' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/bin/rake:22:in `<main>' 
/home/deplguerrabr/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval' 

私はいくつかの関連する問題にリダイレクトされたウェブ上で検索しますが、それらの誰も私のように厳密に同じではなかったです。 1)私は認証用にdeviseを使用しています(バージョン3.4.1) 2)この問題は本番環境でのみ発生します 3)私はプロダクト環境に大きな影響を与える問題を列挙します。生産・開発 環境 4でルビーやレールの同じバージョン)ここでは、私が使用していた宝石です:

actionmailer (4.2.6) 
actionpack (4.2.6) 
actionview (4.2.6) 
activejob (4.2.6) 
activemodel (4.2.6) 
activerecord (4.2.6) 
activesupport (4.2.6) 
acts_as_votable (0.10.0) 
arel (6.0.3) 
autoprefixer-rails (6.4.1.1, 6.3.7, 6.3.6) 
bcrypt (3.1.11) 
bigdecimal (default: 1.2.8) 
binding_of_caller (0.7.2) 
bootstrap-sass (3.2.0.2) 
bootstrap-tagsinput-rails (0.4.2.1) 
bootsy (2.2.2) 
bson (3.2.6) 
bson_ext (1.5.1) 
builder (3.2.2) 
bundler (1.12.5) 
bundler-unload (1.0.2) 
bxslider-rails (4.2.5.1) 
byebug (9.0.5, 9.0.3) 
cancancan (1.14.0) 
carrierwave (0.11.2) 
carrierwave-mongoid (0.10.0, 0.9.0) 
client_side_validations (4.2.3) 
climate_control (0.0.3) 
cocaine (0.5.8) 
coffee-rails (4.1.1) 
coffee-script (2.4.1) 
coffee-script-source (1.10.0) 
commonjs (0.2.7) 
concurrent-ruby (1.0.2) 
countries (1.2.5) 
country_select (2.5.2) 
currencies (0.4.2) 
debug_inspector (0.0.2) 
devise (4.2.0, 4.1.1, 3.4.1) 
did_you_mean (1.0.0) 
erubis (2.7.0) 
execjs (2.7.0, 2.6.0) 
executable-hooks (1.3.2) 
faraday (0.9.2) 
faraday_middleware (0.9.2) 
fileutils (0.7) 
font-awesome-rails (4.6.3.0) 
gem-wrappers (1.2.7) 
geoip (1.4.0) 
globalid (0.3.7, 0.3.6) 
gmaps4rails (2.1.2) 
google_visualr (2.5.1) 
haml (4.0.7) 
hashie (3.4.4) 
httpauth (0.2.1) 
i18n (0.7.0) 
i18n_data (0.7.0) 
image-picker-rails (0.2.4) 
instagram (1.1.6) 
io-console (default: 0.4.5) 
jbuilder (2.6.0, 2.5.0, 2.4.1) 
jquery-migrate-rails (1.2.1) 
jquery-rails (4.2.1, 4.1.1) 
jquery-slick-rails (1.6.0.2) 
jquery-ui-rails (5.0.5) 
js_regex (1.0.14) 
json (default: 1.8.3) 
jwt (1.5.4, 1.5.1, 0.1.13) 
kaminari (0.16.3) 
less (2.6.0) 
less-rails (2.7.1) 
libv8 (3.16.14.15 x86_64-linux) 
loofah (2.0.3) 
mail (2.6.4) 
mime-types (3.1, 3.0) 
mime-types-data (3.2016.0521, 3.2016.0221) 
mimemagic (0.3.2, 0.3.1) 
mini_magick (4.5.1) 
mini_portile2 (2.1.0, 2.0.0) 
minitest (5.9.0, 5.8.3) 
mongo (2.1.0.beta) 
multi_json (1.12.1, 1.12.0) 
multi_xml (0.5.5) 
multipart-post (2.0.0) 
mysql2 (0.4.4) 
nested_form (0.3.2) 
net-telnet (0.1.1) 
nokogiri (1.6.8, 1.6.7.2) 
oauth (0.5.1) 
oauth2 (1.2.0, 1.1.0, 0.8.1) 
omniauth (1.3.1) 
omniauth-facebook (4.0.0, 3.0.0, 1.4.0) 
omniauth-oauth (1.1.0) 
omniauth-oauth2 (1.4.0, 1.0.3) 
omniauth-twitter (1.2.1) 
origin (2.2.0) 
orm_adapter (0.5.0) 
paperclip (5.0.0.beta2) 
passenger (5.0.28) 
pdf-core (0.6.1) 
pg (0.18.4) 
pkg-config (1.1.7) 
power_assert (0.2.6) 
prawn (2.1.0) 
prawn-table (0.2.2) 
prawnto_2 (0.2.6) 
psych (default: 2.0.17) 
rack (1.6.4) 
rack-pjax (0.8.0) 
rack-test (0.6.3) 
rails (4.2.6) 
rails-api (0.4.0) 
rails-deprecated_sanitizer (1.0.3) 
rails-dom-testing (1.0.7) 
rails-html-sanitizer (1.0.3) 
rails_12factor (0.0.3) 
rails_admin (0.8.1) 
rails_serve_static_assets (0.0.5) 
rails_stdout_logging (0.0.5) 
railties (4.2.6) 
rake (11.2.2, 11.1.2, 10.4.2) 
rdoc (4.2.2, default: 4.2.1) 
recaptcha (3.2.0) 
ref (2.0.0) 
regexp_parser (0.3.3) 
remotipart (1.2.1) 
responders (2.3.0, 2.2.0) 
rmagick (2.15.4) 
rubygems-bundler (1.4.4) 
rubygems-update (2.6.4) 
rvm (1.11.3.9) 
safe_yaml (1.0.4) 
sass (3.4.22) 
sass-rails (5.0.6, 5.0.5, 5.0.4) 
sdoc (0.4.1) 
simple_form (3.3.1, 3.2.1) 
sort_alphabetical (1.0.2) 
spring (1.7.2, 1.7.1) 
sprockets (3.7.0, 3.6.3, 3.6.0) 
sprockets-rails (3.2.0, 3.1.1, 3.0.4) 
test-unit (3.1.5) 
therubyracer (0.12.2) 
thor (0.19.1) 
thread_safe (0.3.5) 
tilt (2.0.5, 2.0.4) 
time_difference (0.4.2) 
ttfunk (1.4.0) 
turbolinks (5.0.1, 5.0.0, 2.5.3) 
turbolinks-source (5.0.0) 
twitter-bootswatch-rails (3.3.4.0) 
twitter-bootswatch-rails-helpers (3.3.2.0) 
tzinfo (1.2.2) 
uglifier (3.0.2, 3.0.0) 
underscore-rails (1.8.3) 
unicode_utils (1.4.0) 
warden (1.2.6) 
web-console (2.3.0) 
wysiwyg-rails (2.2.4) 

Finalyは、ここに私のconfig/application.rbコードです:

require File.expand_path('../boot', __FILE__) 

require "rails" 
# Pick the frameworks you want: 
require "active_model/railtie" 
require "active_job/railtie" 
# require "active_record/railtie" 
require "action_controller/railtie" 
require "action_mailer/railtie" 
require "action_view/railtie" 
require "sprockets/railtie" 
require "rails/test_unit/railtie" 

# Require the gems listed in Gemfile, including any gems 
# you've limited to :test, :development, or :production. 
Bundler.require(*Rails.groups) 

module Comigo 
    class Application < Rails::Application 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # -- all .rb files in that directory are automatically loaded. 

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 
    # config.time_zone = 'Central Time (US & Canada)' 

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 
    # config.i18n.default_locale = :de 
    config.action_view.javascript_expansions[:defaults] = %w(jquery.min jquery_ujs) 
    end 

ありがとう、私は誰でもca私を助けてください。私はこの問題に数時間悩まされています!

+1

railsのアセットパイプラインを使用して、その行(エラーが指す行)を削除し、javascriptにjquery.minとjquery_ujsを追加する必要がありますapplication.jsマニフェスト – arieljuod

+0

コードを投稿できますか?私はあなたが話しているラインについて確信が持てません... –

+0

ありがとう、助けてくれました! –

答えて

0

arieljuodは問題を解決するのを助けました。

//= require jquery 
//= require jquery_ujs 

と私は次のように私のconfig/application.rbコードを変更:私はちょうどこれらの線は、次の順序で資産/ JavaScriptの/ application.jsに追加されたことを確認しました

require File.expand_path('../boot', __FILE__) 

require "rails" 
# Pick the frameworks you want: 
require "active_model/railtie" 
require "active_job/railtie" 
# require "active_record/railtie" 
require "action_controller/railtie" 
require "action_mailer/railtie" 
require "action_view/railtie" 
require "sprockets/railtie" 
require "rails/test_unit/railtie" 

# Require the gems listed in Gemfile, including any gems 
# you've limited to :test, :development, or :production. 
Bundler.require(*Rails.groups) 

module Comigo 
    class Application < Rails::Application 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # -- all .rb files in that directory are automatically loaded. 

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 
    # config.time_zone = 'Central Time (US & Canada)' 

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 
    # config.i18n.default_locale = :de 
    #config.action_view.javascript_expansions[:defaults] = %w(jquery.min jquery_ujs) 
    end 

速い解決策ですが、それは数時間かかりました。D

関連する問題