TextMate-like Template Syntax for RADRails

UPDATE: Dr Nic carried the torch and converted all of TextMates snippets to radrails templates. These templates will also be included in the next RADRails release 0.7.2 which will come out the week of November 20th. If you cant wait, read Dr Nic’s post now and get his updated templates.

Now TextMate users can migrate to RADRails even easier after their 30-day Trial period is over.

I have gone through most of the Rails commands in TextMate and made equivalent templates in RADRails. If anything it will make it easier for rails developers to move back and forth between the two most popular IDEs.

Download: 2006-09-18.RADRails-TextMate_Templates-v1.xml

(right click and Save As..)

Instructions

In RADRails:

  1. Window → Preferences → Ruby → Templates
  2. Import…
  3. Browse to the template file.
  4. Hit ‘OK’ and prepare for some down and dirty ball cupping

In a Ruby editor type your favourite TextMate command then hit <ctrl+space> and select the template from the list by pressing ‘enter’.

eg.

habtm<ctrl+space> (select textmate - has_and_belongs_to_many template)

Hit tab to cycle through available fields.

*Note: this is an initial release and only includes templates for Models, Views and Controllers. A few rails templates are missing, most notably, migrations.

In the next release I hope to include all TextMate HTML templates, tags, doctypes, etc. And maybe even a little extra goodies.

I am hoping that in RADRails versions to come that these templates are included with the release, and perhaps even Tab completion for templates so it works exactly like textmate.

Snippets (Tab Triggers)

Controllers

  • rea : redirect_to(action)
  • rei : redirect_to(index)
  • rec : redirect_to(controller)
  • reca : redirect_to(controller, action)
  • recai : redirect_to(controller, action, index)
  • ra : render(action)
  • ral : render(action, layout)
  • rf : render(file)
  • rfu : render(file, use_full_path)
  • ri : render(inline)
  • ril : render(inline, locals)
  • rit : render(inline, type)
  • rl : render(layout)
  • rn : render(nothing)
  • rns : render(nothing, status)
  • rp : render(partial)
  • rpc : render(partial, collection)
  • rpl : render(partial, locals)
  • rpo : render(partial, object)
  • rps : render(partial, status)
  • rt : render(text)
  • rtl : render(text,layout)
  • rtit : render(text, layout => true)
  • rts : render(text, status)
  • rcea : render_component(action)
  • rcec : render_component(controller)
  • rceca : render_component(controller, action)

Models

  • bt : belongs_to
  • habtm : has_and_belongs_to_many
  • ho : has_one
  • hm : has_many
  • va : validates_associated
  • vaif : validates_associated if
  • vc : validates_confirmation_of
  • vcif : validates_confirmation_of if
  • ve : validates_exclusion
  • ve : validates_exclusion if
  • vl : validates_length
  • vp : validates_presence_of
  • vpif : validates_presence_of if
  • vu : validates_uniqueness_of
  • vuif : validates_uniqueness_of if

Views

  • forin : for .. in .. end
  • ft : form_tag
  • lia : link_to(action)
  • liai : link_to(action, index)
  • lic : link_to(controller)
  • lica : link_to(controller, action)
  • licai : link_to(controller, action, index)

Migrations (coming in next release)

HTML (more coming soon..)

  • table : an html table

Link to my original post and discussion on the RADRails blog



About this entry


Trackbacks

Use the following link to trackback from your own site:
http://weare.buildingsky.net/trackbacks?article_id=256

  1. TextMate-like Template Syntax for RADRails Now TextMate users can migrate to RADRails even easier after their 30-day Trial period is over. I have gone through most of the Rails commands in TextMate and made equivalent templates in RADRails. If any...
  2. "I have gone through most of the Rails commands in TextMate and made equivalent templates in RADRails. If anything it will make it easier for rails developers to move back and forth between the two most popular IDEs."
  3. In case you are wondering about your choice of development environment for Ruby on Rails and you are looking at TextMate and RadRails here are 2 interesting blog posts an how to 'enhance' RadRails and make it work more like TextMate. Dr Nic has a
  4. RadRails textmate templates Deville Companies, Sam, and Life
    I have been inspired by earlier templates for RadRails and by the templates for JEdit, I have created another set of templates. These ones use the same commands as TextMate, and can use the same reference as the ones for JEdit (although I will try...

About

    Buildingsky.net is comprised of a group of computer science enthusiasts. We build, experiment and learn together.

    We are interested in HTML5, Ruby, Javascript, DSP, and finance/economics.

Contact

Projects

Categories