Skip to content
Rails 3, Ruby 1.9 oriented snippets
Find file
Pull request Compare This branch is 1 commit ahead, 47 commits behind tadast:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
messages
$LABEL.sublime-snippet
%3C%=-Fixtures_identify(%3Asymbol)-%%3E.sublime-snippet
.gitignore
180-rails-form_tag.sublime-snippet
Create-binary-column.sublime-snippet
Create-boolean-column.sublime-snippet
Create-controller-class.sublime-snippet
Create-date-column.sublime-snippet
Create-datetime-column.sublime-snippet
Create-decimal-column.sublime-snippet
Create-float-column.sublime-snippet
Create-functional-test-class.sublime-snippet
Create-integer-column.sublime-snippet
Create-lock_version-column.sublime-snippet
Create-references-column.sublime-snippet
Create-string-column.sublime-snippet
Create-text-column.sublime-snippet
Create-time-column.sublime-snippet
Create-timestamp-column.sublime-snippet
Create-timestamps-columns.sublime-snippet
HTML (Rails).tmLanguage
JavaScript (Rails).tmLanguage
Migration-Add-Column.sublime-snippet
Migration-Create-Column-(mcc).sublime-snippet
Migration-Create-Column-Continue-(mccc).sublime-snippet
Migration-Create-Table-(mdct).sublime-snippet
Migration-Drop-Table-(mdct).sublime-snippet
Migration-Remove-Column.sublime-snippet
RAILS_DEFAULT_LOGGER.debug-(rdb).sublime-snippet
README.md
Ruby Haml Comments.tmPreferences
Ruby Haml.tmLanguage
Ruby on Rails.tmLanguage
SQL (Rails).tmLanguage
Table-column(s)-rename.sublime-snippet
Template (ERB).tmPreferences
Template (Haml).tmPreferences
Test-Assert-Redirected-To-(art).sublime-snippet
Test-Assert-Response-(are).sublime-snippet
active-record-class-end.sublime-snippet
after_create.sublime-snippet
after_destroy.sublime-snippet
after_save.sublime-snippet
after_update.sublime-snippet
after_validation.sublime-snippet
after_validation_on_create.sublime-snippet
after_validation_on_update.sublime-snippet
assert(var-=-assigns(%3Avar)).sublime-snippet
assert_difference.sublime-snippet
assert_no_difference.sublime-snippet
assert_redirected_to-(nested-path).sublime-snippet
assert_redirected_to-(nested-path-plural).sublime-snippet
assert_redirected_to-(path).sublime-snippet
assert_redirected_to-(path-plural).sublime-snippet
assert_select.sublime-snippet
before_create.sublime-snippet
before_destroy.sublime-snippet
before_save.sublime-snippet
before_update.sublime-snippet
before_validation.sublime-snippet
before_validation_on_create.sublime-snippet
before_validation_on_update.sublime-snippet
belongs_to-(bt).sublime-snippet
cattr_accessor.sublime-snippet
class-end.sublime-snippet
crud-actions.sublime-snippet
def-create-resource.sublime-snippet
def-get-request.sublime-snippet
def-post-request.sublime-snippet
end.sublime-snippet
find(%3Aall).sublime-snippet
find(%3Afirst).sublime-snippet
find(id).sublime-snippet
for-loop-erb.sublime-snippet
form_for-check_box.sublime-snippet
form_for-checkbox.sublime-snippet
form_for-file_field-2.sublime-snippet
form_for-file_field.sublime-snippet
form_for-hidden_field-2.sublime-snippet
form_for-hidden_field.sublime-snippet
form_for-label-2.sublime-snippet
form_for-label.sublime-snippet
form_for-password_field-2.sublime-snippet
form_for-password_field.sublime-snippet
form_for-radio_box-2.sublime-snippet
form_for-radio_box.sublime-snippet
form_for-submit-2.sublime-snippet
form_for-submit.sublime-snippet
form_for-text_area-2.sublime-snippet
form_for-text_area.sublime-snippet
form_for-text_field-2.sublime-snippet
form_for-text_field.sublime-snippet
form_for-with-errors.sublime-snippet
form_for.sublime-snippet
has_and_belongs_to_many-(habtm).sublime-snippet
has_many-(hm).sublime-snippet
has_many-(through).sublime-snippet
has_many-dependent-=-destroy.sublime-snippet
has_one-(ho).sublime-snippet
image_submit_tag.sublime-snippet
javascript_include_tag.sublime-snippet
lia.sublime-snippet
liai.sublime-snippet
lic.sublime-snippet
lica.sublime-snippet
licai.sublime-snippet
link_to-(nested-path).sublime-snippet
link_to-(nested-path-plural).sublime-snippet
link_to-(path).sublime-snippet
link_to-(path-plural).sublime-snippet
link_to-model.sublime-snippet
logger_debug.sublime-snippet
logger_error.sublime-snippet
logger_fatal.sublime-snippet
logger_info.sublime-snippet
logger_warn.sublime-snippet
map(-%3Asym_proc).sublime-snippet
mattr_accessor.sublime-snippet
messages.json
named_scope-lambda.sublime-snippet
named_scope.sublime-snippet
rails-flash.sublime-snippet
rea.sublime-snippet
reai.sublime-snippet
rec.sublime-snippet
reca.sublime-snippet
recai.sublime-snippet
redirect_to-(nested-path).sublime-snippet
redirect_to-(nested-path-plural).sublime-snippet
redirect_to-(path).sublime-snippet
redirect_to-(path-plural).sublime-snippet
render-(action)...-(ra).sublime-snippet
render-(action-layout)-(ral).sublime-snippet
render-(file)-(rf).sublime-snippet
render-(file-use_full_path)-(rfu).sublime-snippet
render-(inline)-(ri).sublime-snippet
render-(inline-locals)-(ril).sublime-snippet
render-(inline-type)-(rit).sublime-snippet
render-(layout)-(rl).sublime-snippet
render-(nothing)-(rn).sublime-snippet
render-(nothing-status)-(rns).sublime-snippet
render-(partial)-(rp).sublime-snippet
render-(partial-collection)-(rpc).sublime-snippet
render-(partial-locals)-(rpl).sublime-snippet
render-(partial-object)-(rpo).sublime-snippet
render-(partial-status)-(rps).sublime-snippet
render-(text)-(rt).sublime-snippet
render-(text-layout)-(rtl).sublime-snippet
render-(text-layout=%3Etrue)-(rtlt).sublime-snippet
render-(text-status)-(rts).sublime-snippet
render-(update).sublime-snippet
respond_to.sublime-snippet
returning-do-%7Cvariable%7C-%E2%80%A6-end.sublime-snippet
routes_resource_only.sublime-snippet
routes_resources.sublime-snippet
routes_resources_block.sublime-snippet
routes_resources_collection_block.sublime-snippet
routes_resources_member_block.sublime-snippet
stylesheet_link_tag.sublime-snippet
submit_tag.sublime-snippet
t_binary-(tcbi).sublime-snippet
t_boolean-(tcb).sublime-snippet
t_date-(tcda).sublime-snippet
t_datetime-(tcdt).sublime-snippet
t_decimal-(tcd).sublime-snippet
t_float-(tcf).sublime-snippet
t_integer-(tci).sublime-snippet
t_lock_version-(tcl).sublime-snippet
t_references-(tcr).sublime-snippet
t_rename-(tre).sublime-snippet
t_string-(tcs).sublime-snippet
t_text-(tct).sublime-snippet
t_time-(tcti).sublime-snippet
t_timestamp-(tcts).sublime-snippet
t_timestamps-(tctss).sublime-snippet
validates_acceptance_of-if.sublime-snippet
validates_acceptance_of.sublime-snippet
validates_associated-(va).sublime-snippet
validates_associated-if-(vaif).sublime-snippet
validates_confirmation_of-(vc).sublime-snippet
validates_confirmation_of-if-(vcif).sublime-snippet
validates_exclusion_of-(ve).sublime-snippet
validates_exclusion_of-if-(veif).sublime-snippet
validates_format_of-if.sublime-snippet
validates_format_of.sublime-snippet
validates_inclusion_of-if.sublime-snippet
validates_inclusion_of.sublime-snippet
validates_length_of-(vl).sublime-snippet
validates_length_of-if.sublime-snippet
validates_numericality_of-if.sublime-snippet
validates_numericality_of.sublime-snippet
validates_presence_of-(vp).sublime-snippet
validates_presence_of-if-(vpif)-2.sublime-snippet
validates_uniqueness_of-(vu).sublime-snippet
validates_uniqueness_of-if-(vuif).sublime-snippet
verify-(verify).sublime-snippet
verify-redirect-(verify).sublime-snippet
wants_format.sublime-snippet
xhr-delete.sublime-snippet
xhr-get.sublime-snippet
xhr-post.sublime-snippet
xhr-put.sublime-snippet

README.md

Sublime Text 2 Rails snippets

This replaces the default Rails snippets from Sublime Text 2. All the features can be found in this cheatsheet generated by Snipcheat.

Installation

** This package replaces the default Sublime Rails snippets.**

If you installed it via Package control, you will need to do some housekeeping, see troubleshooting.

Regardless of which way of installation you choose, please backup the old Rails snippets installation. You don't want to have both this and the original installed.

➜ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
➜ mv Rails ~/.RailsSublimeBackup

From Git

➜ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
➜ git clone https://github.com/tadast/sublime-rails-snippets.git Rails

It is important to clone it into a folder called Rails. Some other snippets have hardcoded dependencies pointing to that path. See troubleshooting.

From an archive

  • Go to the downloads section
  • Download the preferred type of archive.
  • Extract it to your Packages/Rails

From Package control

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

Troubleshooting

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 plugin.

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"}}
  ]
}

For all the changes to take effect you may also need to quit Sublime and delete Sublime's session cache.

rm ~/Library/Application\ Support/Sublime\ Text\ 2/Settings/Session.sublime_session

This will lose all session data (Sublime will 'forget' open filetabs, projects, search history etc.)

Sublime picks Ruby syntax

You may need to tell Sublime to prefer Rails View -> Syntax -> Open all with current extension as... and pick Rails of Ruby on Rails snippets

Something went wrong with that request. Please try again.