22. Ruby on Rails is an open-source web
framework that's optimized for
programmer happiness and sustainable
productivity.
It lets you write beautiful code by
favoring convention over configuration
25. All in one! ASP.NET Ruby on Rails
MVC
Presentation ASP.NET Rails
MVC
Database migrations T-SQL Rails
Data access & LINQ to Rails
persistence Entities
Unit testing NUnit Rails
Testing web pages (?) Rails
Testing cookies and (?) Rails
session state
27. Conventions
• Singular camel cased model/class
names
• Plural lower case and underscored
• Db table names
• Variable names
• Method names
• Primary key called “id”
• Db fields called created_at and
updated_at
• Get free timestamps when performing
29. An object that wraps a row in a
database table or view,
encapsulates the database access,
and adds domain logic on that
data. ~ Martin Fowler Active
Record
37. Step 2 (optional)
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
38. Step 3 – Boot Mongrel
Or use the Passenger Preference Pane for
Apache2
def is_friday?
today = Date.today
friday = today.end_of_week - 2.days
today == friday
end
today = Date.today
puts "I'm in a good mood” if today.is_friday?
puts "I'm in a bad mood" unless today.is_friday?
today.is_friday? ? "great mood" : "bad mood"
Public and private methods don’t “really” exist… you can use send to call them. Private and protected are really just ideas… I intend for you not to call this because I may change this and you should not rely on it
Rails isn’t academic software. Every feature is extracted from a plugin or a working project from 37signals