Presenter – Brad Tutterow
Ruby is a programming language, Rails is a Web Framework built on top of it.
- So, what’s the big deal?
- #1, It’s FUN!
- #2, It’s EASY!
- Standard Setup
- Convention over Configuration
- #3, It’s PRODUCTIVE
- Why should I care?
- Broaden your horizons, become a generalist, rather than a specialist
- It will make you a better Developer
- What is Ruby?
- Object Oriented
- Dynamically Typed
- More flexible, but less structured
- Don’t see errors at compile time
- Somewhat requires Unit Testing to prevent runtime errors
- Duck Typing
- Comes from “if it walks like a duck, quacks like a duck…”
- The Ruby Language
- .each Method (similar to foreach)
- Everything is an object in Ruby
- next_week = 10.days.from.now
- unless statement
- unless today.is_saturday_or_sunday? <- ? returns a boolean
- if at the end
- Strongly typed, but not statically typed
- No diacritic marks ({, ())
- The Rails Framework
- Free and open source web framework
- Does Web applications with a database back-end very well
- It’s a very specific framework
- Uses MVC Framework (Model, View, Controller
- Three Tenets
- Convention over Configuration
- Via scaffolding, can write boilerplate code to get all, get by id, build tables, etc.
- Don’t Repeat Yourself
- Each piece of knowledge should have one and only one place to live
- ActiveRecord
- An object should have the logic to put itself in the database and take itself back out of the database
- RadRails for aptana
- Netbeans IDE
- Create a Rails project in 3 steps
- rails project_name at command line
- Edit yaml file for database setup
- ruby script/server
- MVC
- request comes into controller
- controller looks at the model to pull what it needs
- it then pushes that to the view
- view provides the response
- controllers have actions (which are just methods)
- URL (controller/action/parameters)
- Controller code is written to get data from the model
- Models
- Create a new model at the command prompt (rails generate model modelname)
- Database migration scripts provide information about how to setup and teardown databases
- Free Methods
- find by id
- find by name
- find all
- sort
- Forms
- Scaffolding builds the forms for you
Great Book – RailsSpace (Michael Hartl)