Rails:如何逐步调试请求

时间:2011-06-22 03:12:11

标签: ruby-on-rails ruby-on-rails-3 debugging request actioncontroller

我有一个ajax请求导致我的Rails 3.0.9应用程序出现问题。我可以在日志中看到问题,但我不知道在ajax调用和渲染之间触发它的是什么。这是日志,以及我不想要的事件 * *旁边:

Started DELETE "/notifications/13" for 127.0.0.1 at 2011-06-21 22:08:39 -0500
  Processing by NotificationsController#destroy as JS
  Parameters: {"id"=>"13"}
  SQL (0.4ms)   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'

  SQL (0.3ms)   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  User Load (0.8ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
  Slug Load (0.4ms)  SELECT "slugs".* FROM "slugs" WHERE ("slugs".sluggable_id = 1 AND "slugs".sluggable_type = 'User') ORDER BY id DESC LIMIT 1
  ****AREL (0.3ms)  UPDATE "users" SET "remember_token" = NULL, "remember_created_at" = NULL, "updated_at" = '2011-06-22 03:08:40.084049', "preferences" = '---
:email_notifications: ''true''
' WHERE "users"."id" = 1
  Notification Load (0.2ms)  SELECT "notifications".* FROM "notifications" WHERE "notifications"."id" = 13 LIMIT 1
  User Load (0.9ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
  AREL (0.3ms)  UPDATE "users" SET "notifications_count" = COALESCE("notifications_count", 0) - 1 WHERE "users"."id" = 1
  AREL (0.1ms)  DELETE FROM "notifications" WHERE "notifications"."id" = 13
Completed 200 OK in 1334ms

我想以某种方式逐步调试此请求,有点像使用firebug在javascript中逐步执行函数的方式。

有没有办法像这样调试,所以我可以看到如何调用特定的AREL命令??

1 个答案:

答案 0 :(得分:2)

你看过ruby on rails guides - debugging吗?你可以像在gdb中一样进行调试

railscast也很有用。