Ruby Rails Cheat Sheet

ADVERTISEMENT

Methods
DEFAULT DIRECTORY STRUCTURE
PRE-DEFINED VARIABLES
Arrays
$!
Exception information
rails_root
assoc
$&
String of last match
app
at
$`
String left of last match
apis
clear
$'
String right of last match
collect!
controllers
compact!
$+
Last group of last match
application.rb
concat
$N
Nth group of last match
helpers
delete
$=
Case insensitive flag
delete_at
application_helper.rb
delete_if
$/
Input record separator
models
Methods
each
$\
Output record separator
views
each_index
Strings
$,
Output field separator
empty?
layouts
capitalize!
$.
eql?
Current line number of
components
center
fill
last file read
chomp!
config
first
chop!
$>
Default output for print
environments
flatten!
concat
$_
Last input line of string
count
include?
development.rb
crypt
index
$0
Name of script
production.rb
delete!
indexes
$*
Command line arguments
downcase!
test.rb
join
dump
$stderr
Standard error output
last
database.yml
each
length
$stdin
Standard input
each_byte
environment.rb
nitems
empty?
$stdout
Standard output
routes.rb
gsub!
pack
$-a
True if -a is set.
hash
db
pop
hex
$-d
Status of -d switch
push
doc
include?
rassoc
$-l
True if -l is set
index
lib
reject!
intern
$-p
True if -p is set
log
replace
length
$-v
Verbose Flag
ljust, rjust
reverse!
development.log
next!
reverse_each
production.log
oct
rindex
replace
RESERVED WORDS
server.log
shift
reverse!
slice!
test.log
rindex
=begin
elsif
rescue
sort!
scan
public
=end
retry
uniq!
slice!
end
images
split
unshift
BEGIN
ensure
return
squeeze!
javascripts
strip!
END
false
self
Validation
controls.js
sub!
alias
for
super
condition_block?
sum
dragdrop.js
create!
and
if
then
swapcase!
effects.js
evaluate_condition
tr!
true
begin
in
tr_s!
validate
prototype.js
break
module
undef
unpack
validate_on_create
stylesheets
upcase!
validate_on_update
case
next
unless
upto
.htaccess
validates_acceptance_of
until
class
nil
404.html
validates_associated
Regex
def
not
when
validates_confirmation_of
escape
500.html
defined?
or
while
validates_each
last_match
dispatch.cgi
new
validates_exclusion_of
do
redo
yield
quote
dispatch.fcgi
validates_format_of
else
casefold?
validates_inclusion_of
dispatch.rb
kcode
validates_length_of
match
favicon.ico
validates_numericality_of
source
REGULAR EXPRESSIONS SYNTAX
index.html
validates_presence_of
Time
script
validates_size_of
^
Start of string
asctime
validates_uniqueness_of
test
ctime
$
End of string
fixtures
day
Enumerable Mixin
.
Any single character
gmt?
functional
collect
gmtime
(a|b)
a or b
each_with_index
hour
mocks
(...)
Group section
entries
isdst
development
localtime
find
[abc]
Item in range (a or b or c)
test
mday
find_all
[^abc]
Not in range (not a or b or c)
min
grep
unit
mon
a?
Zero or one of a
include?
test_helper.rb
month
a*
max
Zero or more of a
sec
vendor
min
strftime
a+
One or more of a
tv_sec
reject
a{3}
Exactly 3 of a
tv_usec
sort
usec
METHODS NOTE
a{3,}
3 or more of a
utc
Available free from
a{3,6}
Between 3 and 6 of a
utc?
!
- Denotes where a tailing ! may be
wday
!(pattern)
"Not" prefix. Apply rule when
! -
used. A colourless ! denotes that the
yday
URL does not match pattern.
Ruby on Rails Logo
year
! -
! is compulsory.
zone
used with permission.

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go