用于移动应用程序用户登录的Ruby on Rails Web服务

时间:2013-12-25 11:04:49

标签: ruby-on-rails ruby web-services devise ruby-on-rails-4

我正在构建web&我正在使用ROR构建Web应用程序的移动应用程序。我正在使用Rails 4和Devise 3作为身份验证模块,并在我的应用程序中实现它。但现在我想从移动应用程序构建用于用户身份验证的Web服务。我已经按照这些教程First oneSecond one进行了操作,但是当我测试这些服务时,它说500:内部服务器错误,这里是pic。 enter image description here

除此之外,我认为token_authenticable已经降级了......所以请让我知道我哪里出错了,或者提供一些很好的教程来使用设计认证在ROR中创建Web服务。感谢

activesupport (4.0.2)
lib/active_support/dependencies.rb:424:in `load' activesupport
(4.0.2) lib/active_support/dependencies.rb:424:in `block in
load_file' activesupport (4.0.2)
lib/active_support/dependencies.rb:616:in `new_constants_in'
activesupport (4.0.2) lib/active_support/dependencies.rb:423:in
`load_file' activesupport (4.0.2)
lib/active_support/dependencies.rb:324:in `require_or_load'
activesupport (4.0.2) lib/active_support/dependencies.rb:463:in
`load_missing_constant' activesupport (4.0.2)
lib/active_support/dependencies.rb:184:in `const_missing'
activesupport (4.0.2) lib/active_support/inflector/methods.rb:228:in
`const_get' activesupport (4.0.2)
lib/active_support/inflector/methods.rb:228:in `block in
constantize' activesupport (4.0.2)
lib/active_support/inflector/methods.rb:224:in `each'
activesupport (4.0.2) lib/active_support/inflector/methods.rb:224:in
`inject' activesupport (4.0.2)
lib/active_support/inflector/methods.rb:224:in `constantize'
activesupport (4.0.2) lib/active_support/dependencies.rb:535:in
`get' activesupport (4.0.2)
lib/active_support/dependencies.rb:566:in `constantize' actionpack
(4.0.2) lib/action_dispatch/routing/route_set.rb:76:in
`controller_reference' actionpack (4.0.2)
lib/action_dispatch/routing/route_set.rb:66:in `controller'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:44:in
`call' actionpack (4.0.2)
lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in
`each' actionpack (4.0.2)
lib/action_dispatch/journey/router.rb:59:in `call' actionpack
(4.0.2) lib/action_dispatch/routing/route_set.rb:680:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call' warden
(1.2.3) lib/warden/manager.rb:34:in `catch' warden (1.2.3)
lib/warden/manager.rb:34:in `call' rack (1.5.2)
lib/rack/etag.rb:23:in `call' rack (1.5.2)
lib/rack/conditionalget.rb:35:in `call' rack (1.5.2)
lib/rack/head.rb:11:in `call' actionpack (4.0.2)
lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/flash.rb:241:in
`call' rack (1.5.2) lib/rack/session/abstract/id.rb:225:in
`context' rack (1.5.2) lib/rack/session/abstract/id.rb:220:in
`call' actionpack (4.0.2)
lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.2) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.2)
lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in
`call' activerecord (4.0.2) lib/active_record/migration.rb:369:in
`call' actionpack (4.0.2)
lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.2) lib/active_support/callbacks.rb:373:in
`_run__3149087440152064127__call__callbacks' activesupport (4.0.2)
lib/active_support/callbacks.rb:80:in `run_callbacks' actionpack
(4.0.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/reloader.rb:64:in
`call' actionpack (4.0.2)
lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.2)
lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.2)
lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in
`block in tagged' activesupport (4.0.2)
lib/active_support/tagged_logging.rb:25:in `tagged' activesupport
(4.0.2) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `call' actionpack
(4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call' rack (1.5.2)
lib/rack/runtime.rb:17:in `call' activesupport (4.0.2)
lib/active_support/cache/strategy/local_cache.rb:83:in `call' rack
(1.5.2) lib/rack/lock.rb:17:in `call' actionpack (4.0.2)
lib/action_dispatch/middleware/static.rb:64:in `call' rack (1.5.2)
lib/rack/sendfile.rb:112:in `call' railties (4.0.2)
lib/rails/engine.rb:511:in `call' railties (4.0.2)
lib/rails/application.rb:97:in `call' rack (1.5.2)
lib/rack/lock.rb:17:in `call' rack (1.5.2)
lib/rack/content_length.rb:14:in `call' rack (1.5.2)
lib/rack/handler/webrick.rb:60:in `service'
/usr/share/ruby/webrick/httpserver.rb:138:in `service'
/usr/share/ruby/webrick/httpserver.rb:94:in `run'
/usr/share/ruby/webrick/server.rb:295:in `block in
start_thread'
     

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,我错过了一些非常愚蠢的东西,或者我很想在轨道上使用红宝石。

每当您遇到500内部错误时,请检查以下内容

  1. 检查rails服务器端的日志,非常有用
  2. 此问题主要是由于rails端代码中的语法问题
  3. 可能是您传递的参数或实际字段退出模型的问题
  4. 检查模型中的验证,可能会阻止您的请求
  5. 我认为问题主要在于这些问题,但可能是我缺少一些。