UP | HOME

Rails Notes

http://farm4.static.flickr.com/3184/2886745454_222717cf27_m.jpg

Rails commands

rails commands
rails gcall generator
rails crails console
rails dbrails dbconsole
rails newcreate a new rails application

Rinari commands

Rinari is a cool Ruby on Rails minor mode for Emacs.

Key bindingRinari Command
C-c ; ffind command
C-c ; f cFind Controller
C-c ; f mFind Model
C-c ; f vFind View
C-c ; crails console
C-c ; ddbconsole

ruby stuff

# loop 10 times
1.upto(10) { |i| print i, ", " }
puts " "
# open file and read lines
open("/home/bart/rubys/namesdata.txt").readlines.each do |line|
    str = line.split(" ")
    # print all but last 4 fields
    names = str[0..-5]
    puts names.join(" ") + ": " + str[-3].to_s

end