TextMate Ruby/Rails Cheat Sheet
TextMate Ruby/Rails Cheat Sheet
Ruby rcode completion ⌥⎋ require “..” req⇥ New Ruby (Rails) class cla⇥
Run rake task ⌃⇧R File (foreach, read, open) File⇥ def self.name .. end defs⇥
Run current UnitTest ⌘⇧R Option parser block optp⇥ alias_method :new, :old am⇥
SQL COMMANDS ⌃⌥⇧S assert test, message as⇥ Array.new(..) { |i| .. } Array⇥
Execute line/selection ⌃⇧Q New rdoc block =b⇥ [all,any]? { |e| .. } [all,any]⇥
Insert/toggle ERb (select.) ⌃> New module mod⇥ inject(init) { |mem, var| .. } inj⇥
Embed select. code #{..} # do |variables| .. end do⇥ zip(enums) { |row| .. } zip⇥
Goto alternate file ⌥⌘↓ “params[:id]” snippet ⌃P returning do |var| .. end returning⇥
Goto specific file ⌥⌘⇧↓ flash[:notice] = “msg” flash⇥ xhr [get,post,put,delete] x[…]⇥
Goto file on current line ⌥⌘↑ [c,m]attr_accessor :name [c,m]rw⇥ SCOPE REFERENCE
Generate a migration ⌃⇧M verify [redirect, render] verify⇥ def create method block defcreate⇥
Test ... (rake test tasks) ⌃\ assert(v = assigns(:v)) asg⇥ CUCUMBER ⌃⌥⇧C
Autocomplete FK fixture associations: use initials ...⇥ [Given, When, Then] step [giv,whe,the]⇥
⌥[⇧]⎋
reference [habtm] has_many :dependent hmd⇥ Autocomplete step ⌥⎋
key: value snippet ⌃: has_many :through hmt⇥ Create all undef. steps ⌃⌥⌘⇧↓
Manipulate colum[s] mcol⇥[⇥] Run behaviour descript. ⌘R Refactor select. to partial ⌃⇧H
Create columns mccc⇥ Run BD of select. files/dir ⌥⌘R form_for [with errors] ff[e]⇥
Rename column[s] mncc⇥ describe “description” des⇥ f.method (snippet name) f.⇥
page.hide hide⇥ describe REST Controller desrc⇥ If .. for .. end else .. end for⇥
page.insert_html ins⇥ it “should ..” do .. end it⇥ <% end %> end⇥
with_options, catch_all] wo,ca]?⇥ controller_name :name conn⇥ select ʻ..ʼ {.., :from => ʻ..ʼ} sel⇥