Thursday, September 26, 2013

Frequently used commands in Rails vs Slim

render :text => 'test'

# set layout
layout 'layout'

# print odd and even in table
tr class=cycle('list_line_odd', 'list_line_even')

# ruby inside javascript block [slim template]
javascript:
  var config = { 
    custom: "#{my_value ? 'truthy' : 'falsy'}",
    current_user: #{raw current_user.to_json}
  };

No comments :

Post a Comment