我应该编辑哪个 application_rb 文件?

which application_rb file should I edit?

在我的服务器上,我使用 sudo find . -name "application_controller.rb" 进行了搜索。这个名字的文件太多了。我应该编辑哪一个才能使更改反映在我的服务器上?

./home/myapp/apps/myapp/releases/20140208000704/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140116094931/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140114154804/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140117124202/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140120094758/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140116102758/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140117125636/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140116123905/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140116115403/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140117090645/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140121091622/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140212214841/app/controllers/application_controller.rb
./home/myapp/apps/myapp/releases/20140205001541/app/controllers/application_controller.rb
./home/myapp/apps/myapp/shared/cached-copy/app/controllers/application_controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/best_in_place-1.1.2/test_app/app/controllers/application_co      ntroller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/sass-rails-3.2.5/test/fixtures/sass_project/app/controllers      /application_controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/sass-rails-3.2.5/test/fixtures/engine_project/app/controlle      rs/engine_project/application_controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/sass-rails-3.2.5/test/fixtures/engine_project/test/dummy/ap      p/controllers/application_controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/sass-rails-3.2.5/test/fixtures/scss_project/app/controllers      /application_controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/devise-2.0.6/test/rails_app/app/controllers/application_con      troller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/rest-graph-2.0.1/example/rails3/app/controllers/application      _controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/rest-graph-2.0.1/example/rails2/app/controllers/application      _controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/railties-3.2.3/lib/rails/generators/rails/app/templates/app      /controllers/application_controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/railties-3.2.3/guides/code/getting_started/app/controllers/      application_controller.rb
./home/myapp/apps/myapp/shared/bundle/ruby/1.8/gems/gmaps4rails-1.5.6/spec/dummy/app/controllers/application_co      ntroller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/best_in_place-1.1.2/test_app/app/controllers/application_controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/email_spec-1.2.1/examples/rails3_root/app/controllers/application_contr      oller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/sass-rails-3.2.5/test/fixtures/sass_project/app/controllers/application      _controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/sass-rails-3.2.5/test/fixtures/engine_project/app/controllers/engine_pr      oject/application_controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/sass-rails-3.2.5/test/fixtures/engine_project/test/dummy/app/controller      s/application_controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/sass-rails-3.2.5/test/fixtures/scss_project/app/controllers/application      _controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/devise-2.0.6/test/rails_app/app/controllers/application_controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/rest-graph-2.0.1/example/rails3/app/controllers/application_controller.      rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/rest-graph-2.0.1/example/rails2/app/controllers/application_controller.      rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/railties-3.2.3/lib/rails/generators/rails/app/templates/app/controllers      /application_controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/railties-3.2.3/guides/code/getting_started/app/controllers/application_      controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails3.0/app/controllers/application_control      ler.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails3.2/app/controllers/application_control      ler.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails2.3/app/controllers/application_control      ler.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails4.0/app/controllers/application_control      ler.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails3.1/app/controllers/application_control      ler.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails_apps/2.3/empty/app/controllers/applica      tion_controller.rb
./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails_apps/2.3/mycook/app/controllers/applic      ation_controller.rb
myapp@myapp:/$ sufo nano ./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails_apps/      2.3/mycook/app/controllers/application_controller.rb
-bash: sufo: command not found
myapp@myapp:/$ sudo nano ./home/myapp/.rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.14/test/stub/rails_apps/      2.3/mycook/app/controllers/application_controller.rb
myapp@myapp:/$

您不应该更改它们中的任何一个。真的。

./home/myapp/apps/myapp/releases 建议您使用 Capistrano 之类的工具来部署您的应用程序。您应该更新您的源代码,提交并部署它。

如果这不是一个选项,那么您应该查看 ./home/myapp/apps/myapp/current/app/controllers/application_controller.rb 是否存在并进行编辑。如果没有,请选择 `./home/myapp/apps/myapp/releases.

中的最新版本

编辑完成后,您需要重新启动网络服务器才能使更改生效。

再次..我强烈建议不要这样做,除非你别无选择。