Hello
my name is
Alexey Vasiliev (le0pard)
@leopard_me
https://github.com/le0pard
Engineer at
Railsware.com
Slide 3
Slide 3 text
Ways to render web
interface
• Rails render content on backend and send it to
browser
• Rails backend have only REST API and interface
rendered by JavaScript in web application
Slide 4
Slide 4 text
Hybrid web application
• Interface part rendered on backend and part rendered
on frontend
• Very often need to use the same templates for backend
and frontend
• We need DRY!
Slide 5
Slide 5 text
And we love Mustache!
Slide 6
Slide 6 text
smt_rails
• smt_rails (Shared Mustache Templates for Rails 3)
• gem 'smt_rails'
• rails g smt_rails:install
• You're done!
Slide 7
Slide 7 text
Example
Template:
Hello {{msg}}!!!
ActionView:
<%= render "tests/test", :mustache => {msg: "Test"}
%>
JavaScript:
var content = SMT['tests/test']({msg: "Test"});
Slide 8
Slide 8 text
sht_rails
• sht_rails (Shared Handlebars Templates for Rails 3)
• Build for people who like handlebars.js :)