Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Firfi's Profile

GitHub User: Firfi

Comments by


1) Not be amiss to add csrf token in your backbone forms and turn it on in application controller:

def handle_unverified_request
  #TODO add here code to empty the session
  raise ActionController::InvalidAuthenticityToken
<input name="authenticity_token" type="hidden" value="<%= $('meta[name="csrf-token"]').attr('content') %>">

That works fine but I doubt that it is really necessary because browsers have ajax crossdomain restrictions anyway.

I am right or not?

2) I just found it handful when you have multiple fields in your forms use backbone-syphon-rails gem. It doing form serialisation for you and you can write something like that:

createNote: (event) ->
    data = Backbone.Syphon.serialize(this)
    @collection.create data