1

I'm currently adding Backbone.js to an existing Ruby on Rails application. The objective is to display, filter and manipulate some data purely on the client side. I am currently struggling in not duplicating the views I have for data on Rails in Backbone. Ideally I will have one canonical/view/template for use in my application.

My rails views are currently in HAML and have some logic embedded in them for displaying data. I spent some time using Mustache on the client side but I really dislike writing out raw HTML instead of HAML and duplicating the logic found in my rails views.

I am open to any and all suggestions.

Zameer Manji
  • 3,017
  • 5
  • 31
  • 42
  • I use mustache for all my backbone needs. However this answer may be of interest. http://stackoverflow.com/questions/5254396/best-strategy-to-use-haml-template-with-backbone-js – Gazler Oct 12 '11 at 22:02

1 Answers1

0

I wrote an article on re-using rails views (works with HAML, ERB, etc) in Backbone, here: http://lostechies.com/derickbailey/2011/09/06/test-driving-backbone-views-with-jquery-templates-the-jasmine-gem-and-jasmine-jquery/

There are a few other posts linked from there that will give a bit more detail, too.

Derick Bailey
  • 72,004
  • 22
  • 206
  • 219
  • I'm not sure how that post helps me. If I embed my HAML views in my HTML, how will I render them on the client side? – Zameer Manji Oct 13 '11 at 20:42