P
A
B
C
A
S
Thoughts, links, pictures on music, food, wine, film, tech etc.

2009-02-18

I shared this:

'fd' tab trigger in TextMate for creating new Rails form fields

In my screencast below, I used an 'fd' tab trigger in Textmate to generate a div containing a field and a label. This isn't part of the Rails Textmate bundle. Here's the code to generate a label and field inside a div:


<div>
  ${RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}${RAILS_TEMPLATE_END_RUBY_EXPR}
  ${RAILS_TEMPLATE_START_RUBY_EXPR}f.text_field :${1:attribute}${RAILS_TEMPLATE_END_RUBY_EXPR}
</div>

 
Made by Paul Campbell. paul@rushedsunlight.com. Twitter. Github.