intro to ruby on rails
TRANSCRIPT
Ruby on RailsBy Adam Fortuna
Ruby On Rails
Language
Framework
} }
Ruby Code Sample# Output "Hello World! "say = "Hello World!"puts say
# Output "Hello again!"# five timessay = "Hello again!"5.times { puts say }
# Output "HELLO WORLD!"say['hello'] = "Hello World!"puts say.upcase
hello_world.rb
Ruby on Rails (RoR)
Output HTML, Email, XML and more
Read/write to DB
Unit, Functional and Integration Tests
Accept incoming requests
Process Forms
Validation
Restrict Access
ConventionOver
Configuration
CoC
DRYDon’t Repeat Yourself
Rails PartsController Model ViewStart of all requests
Form input
What view is called
Which layout is used
Access DB through Model
Restrict Access(administrator only action?)
Access to database
Real world Objects(Hotel, Resort, etc)
Validation(Hotel.valid?)
Additional methods(User.full_name)
Before hotel save?After hotel Create?
Web pages
Emails
Stylesheets
Javascript
rails hotelmanager
RakeCreate or destroy database
Migrate database forward or back
Generate documentation
Run tests
Deploy
See stats
rake --tasks
ActiveRecord
An object that wraps a row in a database table or view, encapsulates
the database access, and adds domain logic on that data.
- Wikipedia