Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
40Activity
0 of .
Results for:
No results containing your search query
P. 1
TextMate Ruby/Rails Cheat Sheet

TextMate Ruby/Rails Cheat Sheet

Ratings:

4.0

(2)
|Views: 3,899|Likes:
Published by Flo
keyboard shortcuts/reference card; Additionally, there are accompanying cheat sheets for general TextMate usage and Django for TextMate from me.
keyboard shortcuts/reference card; Additionally, there are accompanying cheat sheets for general TextMate usage and Django for TextMate from me.

More info:

Published by: Flo on Apr 13, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/11/2014

pdf

text

original

 
RUBY COMMANDS
⌃⌥⇧
RRuby rcode completion
⌥⎋
Run rake task
⌃⇧
RRun current UnitTest
⌘⇧
ROpen require
⌘⇧
DInsert missing requires
#Execute Line/Selection
⌃⇧
E
SQL COMMANDS
⌃⌥⇧
SDatabase browser
⌥⌘⇧
DExecute line/selection
⌃⇧
Q
RUBY CODE
Toggle string/symbol
:Toggle do .. end / { .. } 
 {Insert/toggle ERb (select.)
>Add ! to method in line
!Begin .. rescue .. end
⌃⇧
WHash pointer
ʻ
=>
ʻ
LEmbed select. code #{..}#
RUBY SNIPPETS
require “..”req
File (foreach, read, open)File
Option parser blockoptp
Add optionopt
UnitTest, TestCase blocktc
def test_
name 
.. enddeft
assert
test 
,
message 
as
assert_(([
a-z
])[a-z]+_?)+as[
a-z
]+
New rdoc block=b
[case, elsif, if, unless,when, while] block...If .. else .. endife
New modulemod
:
key 
=> “
value 
”[,]:
:yieds:
arguments 
y
 { |
variables 
| .. }  {
do |
variables 
| .. enddo
RUBY CLASSES
New Ruby (Rails) classcla
def self.
name 
.. enddefs
alias_method :
new 
, :
old 
am
attr_[read,write,access] ..[r,w,rw]
RUBY FUNCTIONAL
Array.new(..) { |i| .. Array
Hash.new { |h,k| h[k] = .. } Hash
[all,any]? { |
| .. } [all,any]
each { |
| .. } ea
each_(([
a-z
])[a-z]+_?)+ea[
a-z
]+
reverse_each { |
| .. } reve
inject(
init 
) { |
mem 
,
var 
| .. } inj
lambda { |
args 
| .. } lam
map { |
| .. } map
map_with_index { |
,
| .. } mapwi
zip(
enums 
) { |
row 
| .. } zip
TextMate Ruby/Rails/SQL/YAML Cheat SheetTextMate Ruby/Rails/SQL/YAML Cheat Sheet
 
RAILS COMMANDS
⌃⌥⇧
RShow class
ʼ
DB schema
⌃⌘⇧
SGoto alternate file
⌥⌘↓
Goto specific file
⌥⌘⇧↓
Goto file on current line
⌥⌘↑
Generators, migrations,
 fixtures, schema cmds 
ppe
Generate a migration
⌃⇧
MTest ... (rake test tasks)
 \ 
YAML COMMANDS
⌃⌥⇧
YAutocomplete FK fixturereference [habtm]
key 
:
value 
snippet
:Convert to Ruby
⌃⇧
HSyntax cheat sheet
HAdd list item
Sort keys alphabeticallyF5
RAILS SNIPPETS
“session[:
user 
]” snippet
J“params[:
id 
]” snippet
Pflash[:
notice 
] = “
msg 
flash
[c,m]attr_accessor :
name 
[c,m]rw
redirect_to ([
omething 
]+)re[
]+
render ([
omething 
]+)r[
]+
verify [redirect, render]verify
assert(
= assigns(:
))asg
assert_responseasre
assert_rjsasrj
associations: use initials...
has_many :dependenthmd
has_many :throughhmt
validates_(([
a-z
])[a-z]+_?)+
(w/o “_of”, add “if” for :if)
-
before_[
a-z
][a-z]+
bef[
cdus
]
after_[
a-z
][a-z]+
aft[
cdus
]
find([:all,:first,
id 
])fin[a,f,i]
logger.
evel 
log
returning do |
var 
| .. endreturning
xhr [get,post,put,delete]x[…]
SCOPE REFERENCECONTROLLER
respond to (sel. text)
⌘⇧
Hdef create method block
defcreate
CUCUMBER
⌃⌥⇧
CFeaturefea
Scenario, Outlinesc[e,o]
[Given, When, Then] step
[giv,whe,the]
 
Autocomplete step
⌥⎋
Create all undef. steps
⌃⌥⌘⇧↓
Goto current step
⌃⌥⇧↓
Run feature
RRun single scenario
⌘⇧
RAlign table cells
⌥⌘
 \ 
TextMate Ruby/Rails/SQL/YAML Cheat SheetTextMate Ruby/Rails/SQL/YAML Cheat Sheet

Activity (40)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Eric LaLande liked this
tpham liked this
Gabriel Gray liked this
Richard Dowden liked this
xponrails liked this
Loïc Seigland liked this
Philippe Lang liked this
Ilia Drey liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->