"I always thought Smalltalk would beat Java, I just didn't know it would be called 'Ruby' when it did."— Kent Beck
find
, save
has_one
, has_many
, belongs_to
, has_and_belongs_to_many
, has_many_through
find()
call)has_many
associations act as Ruby collectionsacts_as_
{ordered list, nested set, tree, taggable}ModelClass.find()
find_by_X
, find_by_X_and_Y
created at runtimeid
created_
{at
,on
}, updated_
{at
,on
}type
position
parent_id
XXX_id
(foreign keys)lock_version
for optimistic locking.rhtml
.rxml
.rjs
(Ruby code JavaScript generator)
method_missing
; xml.foo outputs <foo>
link_to
and friends (link_to_unless_current
, link_to_remote
)cycle
for even/odd CSS classeslink_to
, image_tag
and friends and specify controller and action; same for stylesheet_link_tag
, javascript_include_tag
requires_login
params
array contains GET/POST request values
flash[]
for temporary messages like error messages or notificationsCan set namespace
rails appname
generate
creates models, contollers, integration tests, mailer, migration, plugin, scaffold, session_migration, web_service
console
and runner
scriptsbenchmarker
, profiler
spinner
, reaper
, spawner
for Fast CGI listner managementAgile Web Dev: : 2nd ed already, paper quickly becomes out of date: pragprog PDF and mlists to keep up
up
and down
methodsSystemClock
(Don't spend too much time on this section.)
acts_as_chunky_bacon
(in other words, writing new AR class behaviors)before_filter
scache()
method in view to surround output you want cachedcaches_page
and caches_action
class methodsPerson.find(1) # becomes an HTTP GET Person.find(:all) # ditto some_person.save # (update) HTTP POST Person.new.save # (create) HTTP PUT some_person.destroy # HTTP DELETE
So...is it hot, or is it not?