Rails 3.2.9来自不同域的不同输出

时间:2012-12-15 14:02:19

标签: ruby ruby-on-rails-3 mongoid

所以我决定编写我的第一个Rails应用程序。

在本地设置,添加Mongoid以使其丰富的数据,添加到文档的路径#index,在开发模式下启动rails -s - 在localhost上一切正常,我看到了一个可用的文档列表。< / p>

BUT!

我的IP在外界可见,因此我将其附加到no-ip.org上的域名。打开同一页面,看到了这个可怕的堆栈跟踪:

开始为获取“/ documents”。。*。*于2012-12-15 17:58:09 +0400

NoMethodError (undefined method `key?' for nil:NilClass):
  actionpack (3.2.9) lib/action_controller/metal/hide_actions.rb:36:in `visible_action?'
  actionpack (3.2.9) lib/action_controller/metal/hide_actions.rb:18:in `method_for_action'
  actionpack (3.2.9) lib/action_controller/metal/implicit_render.rb:14:in `method_for_action'
  actionpack (3.2.9) lib/action_controller/metal/compatibility.rb:61:in `method_for_action'
  actionpack (3.2.9) lib/abstract_controller/base.rb:115:in `process'
  actionpack (3.2.9) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.9) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.9) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.9) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:36:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:601:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.1) lib/rack/etag.rb:23:in `call'
  rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
  rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  activerecord (3.2.9) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.9) lib/active_support/callbacks.rb:405:in `_run__413099900__call__336258148__callbacks'
  activesupport (3.2.9) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.9) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.9) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.9) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.9) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.9) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.9) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.9) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.9) lib/rails/engine.rb:479:in `call'
  railties (3.2.9) lib/rails/application.rb:223:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.9) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'


  Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
  Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
  Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (23.0ms)

这是rails拒绝解释的行:

return @visible_actions[action_name] if @visible_actions.key?(action_name)

越多越好 - 当我在生产模式下启动我的服务器时,localhost和自定义域都会在我脸上吐出相同的堆栈跟踪。

有什么问题?

更新 我的routes.rb文件:

DiplomaRails::Application.routes.draw do

  resources :documents
  resources :doc_sets

end

我的Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.9'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'



# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem "mongoid", "~> 3.0.0"

0 个答案:

没有答案