syncPEOPLE on Rails v.1.0

The following is a detailed description of the features available in the syncPEOPLE on Rails TextMate Bundle Visit the downloads page

Commands

⌘⌥↓: Go To Alternate File

Works in many different contexts. If you're inside a controller's action, it will take you to the view. If you're inside a view, it will take you to the corresponding controller action. Also works for ActionMailer models with their corresponding views. You can also get to helpers, unit and functional tests.

⌘⌥↑: Go To File on Current Line

In order to avoid ambiguity with the Intelligent Go To File command, this separate command exists to let you go to files mentioned on the current line. For example, render :partial, or render :action lines will send you to the appropriate .rhtml view file. You can also visit javascript and stylesheet resource files or redirect_to actions.

⌘⌥⇧↓: Show "Go To Alternate File" Choices

Lets you choose which associated file to visit from within the current context. For example, if the Intelligent Go To File would normally take you from a controller to the view, you can use this menu to take you to the associated functional test instead.

⌃⇧” (with selection): Create Partial from Selection

When inside a view file, select some HTML or erb code that you would like to turn in to a partial. Hit 'command-option-p' and a dialog asking you for the name of your new partial will pop up. Name your partial and hit 'ok'. The selected text will be replaced by a "render :partial" erb fragment and the text will be saved in the newly named partial file.

⌃⇧” (without selection): Inline Partial Edit Mode

When inside a view file that contains one or more "render :partial" statements, hit "command-option-p" without any selection and your partials will be brought in to the current file to be edited. Once done with them, hit command-option-p again and they will be saved to their appropriate locations and removed.

⌃⇧\: Project Commands

The following commands will be listed as Project Commands:

  • Call Generator Script: You will be taken through 2 or 3 simple dialogs to help you generate scaffolds, models, migrations, controllers and more. Runs in the background.
  • Install a Bundled Plugin: Automatically installs a plugin to your current project. Currently, there are only two bundled plugins to choose from: the Rails Engines plugin (James Adam), and the TextMate Footnotes plugin (Duane Johnson).
  • Rake Migrate: Calls 'rake migrate' as if from the command line and reports success or failure.
  • DB Schema Dump: Calls 'rake db_schema_dump' as if from the command line and reports success or failure.
  • DB Schema Import: Calls 'rake db_schema_import' as if from the command line and reports success or failure.

Snippets

Snippets are small capsules of code that are activated by a key sequence followed by the [tab] key. For example, mcdt[tab] will activate the Migration Create and Drop Table snippet.

Migration snippets:

  • mcdt: Migration Create and Drop Table
  • mdct: Migration Drop and Create Table (table must exist in schema.rb)
  • mcc: Migration Create Column
  • marc: Migration Add and Remove Column
  • mrac: Migration Remove and Add Column (table and column must exist in schema.rb)
  • mct: Migration Create Table
  • mdt: Migration Drop Table
  • mac: Migration Add Column
  • mrc: Migration Remove Column

See Sami Samhuri's blog for a more complete description of these snippets, or take a look at them in the syncPeople on Rails Snippets Editor within TextMate.

Assertion snippets:

  • ae: Test Assert Equal
  • ann: Test Assert Not Nil
  • ako: Assert Kind Of
  • are: Assert Response
  • ar: Assert Raise
  • art: Assert Redirected To

Validation snippets:

  • va: Validates Associated
  • vaif: Validates Associated If
  • vc: Validates Confirmation Of
  • vcif: Validates Confirmation Of If
  • ve: Validates Exclusion Of
  • veif: Validates Exclusion Of If
  • vp: Validates Presence Of
  • vpif: Validates Presence Of If
  • vu: Validates Uniqueness Of
  • vuif: Validates Uniqueness Of If

Plugins

textmate_footnotes: Clickable Web Pages and Backtrace

When in development mode on your mac, the textmate_footnotes plugin will make clickable links at the bottom of each web page to take you to the exact controller action or view that generated the page. For example, if you're visiting http://localhost/users/list, clicking on the "Controller" link at the bottom of the page will take you to the UserController#list action inside of TextMate.

You can disable rendering of footnotes on specific actions by specifying the :footnotes => false option in your render call. For example:

  render :partial => 'user', :footnotes => false

The textmate_footnotes plugin also incorporates all of the functionality of the textmate_backtracer plugin. This allows you to click on file names and line numbers that show up on error pages. These, too, will take you back to TextMate for easy editing and correction.

engines: Overridable Components

See http://rails-engines.org/ for an explanation of all of the features of the engines plugin. (Thanks goes to James Adam for pioneering this work).