Start Rails with Backbone.js

I amreading about the backbone.js and make a demo application for the CRUD operation from by goggling some links.

and see the structure of the backbone.js which initial created by installing the gem 'backbone-rails',

But here my query is like when we have normal application like without using of any .js, we have some options to check the flow of the application, like for example we can write 'exit' keyword in controller and check the methods which is calling by routes and can inspect and see all the records and parameters which fetched by model and parameters which input by user .

In using of the backbone.js, i am confusing that from where the view is coming and is there any way to see it's line by line flow means first go to model and for query data can here we can show it in console and see what is going on.


For debug the backbone applications place 'debugger' in your js code and the js execution will stop there if you use chrome. In other browser I am not sure if works but in chrome I used this technique many times... And you can step line by line you can check variables and so on.

For debugging rails use these gems

gem 'pry'
gem 'pry-nav'

Then in your controller where you want to inspect the variables and the calling stack put binding.pry

Like here:

class UsersController <...
  def index
    binding.pry
    @users = Users.all
  end
end
链接地址: http://www.djcxy.com/p/49064.html

上一篇: 定时器在C ++中的回调

下一篇: 用Backbone.js启动Rails