我有一个我最近开发的rails +骨干项目。我无法拨打路线方法。
我的路由器代码:
jar
输出:
Before route working initialize working After route working
无论何时单击路由(假设重定向到特定路由),都会向下面显示的rails服务器发送GET调用。
class Pulse.Routers.MainRouter extends Backbone.Router
routes:
'myroute' : 'myMethod'
before: (route) =>
console.log "Before route working"
after: (route)=>
console.log "After route working"
initialize: =>
console.log "initialize working"
myMethod: =>
console.log Backbone.History.started
# Call is not being transferred here
我一直在敲我的头两天。我哪里错了?
编辑
路由器初始化代码
Started GET "/" for 127.0.0.1 at 2016-08-21 10:49:01 +0530
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
Processing by StaticPagesController#home as HTML
Rendered static_pages/home.html.slim within layouts/application (0.0ms)
Rendered layouts/_shim.html.slim (0.1ms)
Rendered layouts/_header.html.slim (0.5ms)
Rendered layouts/_sidebar.html.slim (0.2ms)
Rendered layouts/_notice.html.slim (0.1ms)
Completed 200 OK in 70ms (Views: 69.6ms | ActiveRecord: 0.0ms
我刚刚检查过。它正在使用Opera 12.16,但不适用于chrome或firefox。