Sublime Text snippets for the latest Ruby and Rails versions
Latest commit 7c56342 Dec 15, 2016 @tadast committed on GitHub Merge pull request #31 from ashishg-qburst/readme
Add package directory info for installing via git on Linux
Permalink
Failed to load latest commit information.
messages Update post-installation message Oct 14, 2015
$LABEL.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
%3C%=-Fixtures_identify(%3Asymbol)-%%3E.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
.gitignore Add .gitignore with *.cache Dec 14, 2012
180-rails-form_tag.sublime-snippet use start_expr for form_for and form_tag helpers (Fixes erb problem) Mar 30, 2013
Create-binary-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-boolean-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-controller-class.sublime-snippet Improve controller class snippet [con] May 25, 2013
Create-date-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-datetime-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-decimal-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-float-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-functional-test-class.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-integer-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-lock_version-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-references-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-string-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-text-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-time-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-timestamp-column.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Create-timestamps-columns.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
HTML (Rails).tmLanguage Move the snippets out of folder for easier installation Nov 28, 2012
JavaScript (Rails).tmLanguage Move the snippets out of folder for easier installation Nov 28, 2012
Migration-Add-Column.sublime-snippet Make options a little more flexible Apr 10, 2013
Migration-Add-Index.sublime-snippet Make options a little more flexible Apr 10, 2013
Migration-Change-Column.sublime-snippet Make options a little more flexible Apr 10, 2013
Migration-Create-Column-(mcc).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Migration-Create-Column-Continue-(mccc).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Migration-Create-Table-(mdct).sublime-snippet mtab does both create and drop table. Fixes #2 Jan 6, 2013
Migration-Drop-Table-(mdct).sublime-snippet mtab does both create and drop table. Fixes #2 Jan 6, 2013
Migration-Remove-Column.sublime-snippet Fix Add/Remove column in migrations Jan 7, 2013
Migration-Remove-Index.sublime-snippet Make options a little more flexible Apr 10, 2013
Migration-Rename-Column.sublime-snippet Make options a little more flexible Apr 10, 2013
RAILS_DEFAULT_LOGGER.debug-(rdb).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
README.md Add package directory info for installing via git on Linux Dec 15, 2016
Ruby Haml Comments.tmPreferences Move the snippets out of folder for easier installation Nov 28, 2012
Ruby Haml.tmLanguage Make Haml's escaping &= appear the same as = Sep 11, 2013
Ruby on Rails.tmLanguage Add _action to support.function.actionpack.rails Jan 6, 2014
SQL (Rails).tmLanguage Move the snippets out of folder for easier installation Nov 28, 2012
Table-column(s)-rename.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Template (ERB).tmPreferences No need for - in erb ends Jan 11, 2013
Template (Haml).tmPreferences Move the snippets out of folder for easier installation Nov 28, 2012
Test-Assert-Redirected-To-(art).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
Test-Assert-Response-(are).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
accepts_nested_attributes_for.sublime-snippet Fix accepts_nested_attributes_for [anaf] Oct 14, 2015
active-record-class-end.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
after_create.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
after_destroy.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
after_save.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
after_update.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
after_validation.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
after_validation_on_create.sublime-snippet Update legacy '<before|after>_validation_on_<create|update>' callbacks Jan 7, 2013
after_validation_on_update.sublime-snippet Update legacy '<before|after>_validation_on_<create|update>' callbacks Jan 7, 2013
assert(var-=-assigns(%3Avar)).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
assert_difference.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
assert_no_difference.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
assert_redirected_to-(nested-path).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
assert_redirected_to-(nested-path-plural).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
assert_redirected_to-(path).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
assert_redirected_to-(path-plural).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
assert_select.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
before_create.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
before_destroy.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
before_save.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
before_update.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
before_validation.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
before_validation_on_create.sublime-snippet Update legacy '<before|after>_validation_on_<create|update>' callbacks Jan 7, 2013
before_validation_on_update.sublime-snippet Update legacy '<before|after>_validation_on_<create|update>' callbacks Jan 7, 2013
belongs_to-(bt).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
binding_pry.sublime-snippet Add bp for binding.pry Feb 18, 2015
byebug.sublime-snippet Add snippet for byebug [bb] Apr 24, 2016
cattr_accessor.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
class-end.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
crud-actions.sublime-snippet Cleanup old snippets Feb 18, 2015
def-create-resource.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
def-get-request.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
def-post-request.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
else.sublime-snippet Add else snippet for ERB [els] Dec 15, 2016
end.sublime-snippet No need for - in erb ends Jan 11, 2013
find(id).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
find_params_id_(fp).sublime-snippet Add find(params[:id]) in controllers [fp] May 25, 2013
for-loop-erb.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-check_box.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-checkbox.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-file_field-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-file_field.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-hidden_field-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-hidden_field.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-label-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-label.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-password_field-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-password_field.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-radio_box-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-radio_box.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-submit-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-submit.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-text_area-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-text_area.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-text_field-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-text_field.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for-with-errors.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
form_for.sublime-snippet use start_expr for form_for and form_tag helpers (Fixes erb problem) Mar 30, 2013
has_and_belongs_to_many-(habtm).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
has_many-(hm).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
has_many-(through).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
has_many-dependent-=-destroy.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
has_one-(ho).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
has_one_through-(hot).sublime-snippet Add has_one through Jan 18, 2013
image_submit_tag.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
initializer-method.sublime-snippet Fix typo Apr 7, 2013
javascript_include_tag-(jit).sublime-snippet Add cache option for javascript_include_tag May 9, 2013
lia.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
liai.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
lic.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
lica.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
licai.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
link_to-(nested-path).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
link_to-(nested-path-plural).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
link_to-(path).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
link_to-(path-plural).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
link_to-model.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
logger_debug.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
logger_error.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
logger_fatal.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
logger_info.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
logger_warn.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
map(-%3Asym_proc).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
mattr_accessor.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
messages.json Installation instructions Nov 28, 2012
named_scope-lambda.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
rails-flash.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
rea.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
reai.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
rec.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
reca.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
recai.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
redirect_to-(nested-path).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
redirect_to-(nested-path-plural).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
redirect_to-(path).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
redirect_to-(path-plural).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(action)...-(ra).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(action-layout)-(ral).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(file)-(rf).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(file-use_full_path)-(rfu).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(inline)-(ri).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(inline-locals)-(ril).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(inline-type)-(rit).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(layout)-(rl).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(nothing)-(rn).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(nothing-status)-(rns).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(partial)-(rp).sublime-snippet Use shorthand partial rendering syntax Aug 16, 2013
render-(partial-collection)-(rpc).sublime-snippet Enable [rpc] and [rpo] snippets in haml Apr 15, 2013
render-(partial-object)-(rpo).sublime-snippet Enable [rpc] and [rpo] snippets in haml Apr 15, 2013
render-(partial-status)-(rps).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(text)-(rt).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(text-layout)-(rtl).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(text-layout=%3Etrue)-(rtlt).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(text-status)-(rts).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
render-(update).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
respond_to.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
returning-do-%7Cvariable%7C-%E2%80%A6-end.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
routes_resource_only.sublime-snippet Rails 3 type route generation Dec 14, 2012
routes_resources.sublime-snippet Rails 3 type route generation Dec 14, 2012
routes_resources_block.sublime-snippet Rails 3 type route generation Dec 14, 2012
routes_resources_collection_block.sublime-snippet Rails 3 type route generation Dec 14, 2012
routes_resources_member_block.sublime-snippet Rails 3 type route generation Dec 14, 2012
scope.sublime-snippet Change scope to use lambda and where Mar 30, 2013
scope_with_args.sublime-snippet Add sope with arguments snippet [scar] Mar 30, 2013
stylesheet_link_tag-(slt).sublime-snippet Rename tag to standard and correct landing point for tab trigger May 9, 2013
submit_tag.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_binary-(tcbi).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_boolean-(tcb).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_date-(tcda).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_datetime-(tcdt).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_decimal-(tcd).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_float-(tcf).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_integer-(tci).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_lock_version-(tcl).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_references-(tcr).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_rename-(tre).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_string-(tcs).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_text-(tct).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_time-(tcti).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_timestamp-(tcts).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
t_timestamps-(tctss).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_acceptance_of-if.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_acceptance_of.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_associated-(va).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_associated-if-(vaif).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_confirmation_of-(vc).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_confirmation_of-if-(vcif).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_exclusion_of-(ve).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_exclusion_of-if-(veif).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_format_of-if.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_format_of.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_inclusion_of-if.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_inclusion_of.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_length_of-(vl).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_length_of-if.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_numericality_of-if.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_numericality_of.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_presence_of-(vp).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_presence_of-if-(vpif)-2.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_uniqueness_of-(vu).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
validates_uniqueness_of-if-(vuif).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
verify-(verify).sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
wants_format.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
xhr-delete.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
xhr-get.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
xhr-post.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012
xhr-put.sublime-snippet Move the snippets out of folder for easier installation Nov 28, 2012

README.md

Sublime Text Rails snippets

This repo provides up-to-date Ruby and Rails snippets for Sublime Text: it's designed to be used with Ruby >= 2.0 and Rails >= 3. All the snippets can be found in this cheatsheet generated by Snipcheat.

class

ActiveRecord

migrations

Installation

If you're using Sublime Text 2, please refer to older installation instructions.

From Package Control

The easiest way to install the snippets is via package control.

However this method has a little downside: it adds new snippets but does not remove the old ones. This means that for some snippet triggers e.g. vp (validates presence) you'll see a drop-down with two options, not one.

Look for "Ruby on Rails snippets" in Package Control. Here's how to install packages

From Git

This method replaces the default outdated snippets, but you have to keep it up to date manually by running git pull every now and again.

To install via git:

  • First, cd into the ST3 Packages directory
# Mac:cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
➜ # Linux:cd ~/.config/sublime-text-3/Packages/
  • Then clone this repo into the folder
➜ ls | grep Rails
➜ # if there is a `Rails` dir, back it up e.g. archive it and remove the original.
➜ git clone https://github.com/tadast/sublime-rails-snippets.git Rails

It is important to clone it into a folder called Rails. Some Sublime plugins have hard-coded dependencies pointing to that path. See troubleshooting.

Troubleshooting

Syntax highlighting doesn't work

You might need to tell Sublime text to use the Ruby on Rails syntax provided by Ruby on Rails Snippets. With an .rb file open and focused navigate to View -> Syntax -> Open all with current extension as... -> Ruby on Rails Snippets -> Ruby on Rails

Sublime picks Ruby (not Rails) syntax

You might need to tell Sublime to prefer Rails over Ruby by navigating to View -> Syntax -> Open all with current extension as... and picking Rails of Ruby on Rails snippets

Can't find *.tmLanguage

If Sublime complains it can't find Ruby on Rails.tmLanguage, chances are you are using this hack.

You'll need to change the path where it looks for that file. Here's the forked version which works with this plug-in.

You may also need to change Packages/(DetectSyntax|User)/DetectSyntax.sublime-settings to replace/include this rule

{
  "name": "Ruby on Rails snippets/Ruby Haml",
  "rules": [
    {"file_name": ".*\\.haml$"}
  ]
},
{
  "name": "Ruby on Rails snippets/Ruby on Rails",
  "rules": [
    {"function": {"name": "is_rails_file"}}
  ]
}

Ruby on Rails snippets is a default installation directory for Package Control. If you installed in a different directory, change the path accordingly

How to contribute

  1. Fork it
  2. Create your feature branch for each group of snippet changes that could be merged individually (git checkout -b my-new-snippet)
  3. Commit your changes (git commit -am 'Add some snippet [tab_trigger]')
  4. Commit messages should start with a verb in present simple tense and have all affected tab triggers in square brackets e.g. "Add a snippets for partial rendering [rpc, rpo]"
  5. Push to the branch (git push origin my-new-snippet)
  6. Create new Pull Request