Ruby on Rails 3 Tutorials
What is Ruby on Rails?
Ruby on Rails is most likely the only reason most people have heard of Ruby. It is Ruby's "killer app," but what is it? Most know it's something to do with web sites or web applications, but what exactly is it? This article explains this and orients you in the Ruby on Rails world.
An Introduction to Rails: a Quick Blog Part 1
It can be quite difficult to orient yourself in the Ruby on Rails world. If you're coming from PHP, there's just so much to learn. You may not even be used to a framework, writing your application code directly mixed with your HTML. If this is the case, then this two-part tutorial will get you started, but is far from a comprehensive tutorial.
An Introduction to Rails: a Quick Blog Part 2
In this part we create an (almost) fully functional blog. We build on what we did last time, generate a posts scaffold and get it all running
Setting up a Rails Development Environment
Before you go full steam ahead, you'll need to get a few things set up. Get these out of the way now and you won't have to stop to install them later.
Installing Ruby on Rails on Windows
Before you can dig in, you need to get Rails installed. This used to be an utter pain on Windows. But not anymore thanks to RailsInstaller. Follow these braindead easy instructions to get up and running in minutes.
Installing Ruby on Rails on OS X
Apple includes Ruby and Ruby on Rails with OS X by default, why do you need to install them? Those versions are usually horribly out of date. OS X Lion came with Ruby 1.8.7 which, while it will work for Rails 3 just fine, Ruby 1.9.3 is so much faster, it really should be used in its place. And Rails versions move so fast, Apple can't hope to...
A New Rails Project
The first step of any new Rails application is to generate a new Rails project. Rails projects are a bit complicated and need a directory hierarchy and a few files to get started, so you can't exactly fire up a text editor and start typing. Generating a new project is not hard though!
A Quick Tour of a Rails Project
Once you generate a new Rails project, you'll get a whole mess of files. If you don't know where anything goes, you'll just be lost. Having a good familiarity with the Rails application hierarchy is essential. There's a bunch of stuff in there, but it's all well organized.
The Rails Installer for OS X
Installing Rails is not the easiest thing in the world... that is, unless you use this handy Rails Installer. It's almost, but not quite, a one-click installer for Ruby, Rails, Git, SQLite and a few other things you'll need for Rails development.
Your First Controller
OK, so you've generated a new project, now what? Let's generate a new controller and see how to add an action.
Using Git With Ruby on Rails
You don't have to use version control software. However, since it's so easy and since it's so important with agile development, you really should be using version control with Rails.
Using Git With Ruby on Rails Part 2: Branches
If all you learn about Git is how to make changes and commit the changes, it can be used effectively. But there's one little feature that makes it all easier, and should be used.
A Bash Prompt for Ruby, Ruby on Rails and Git
There's a lot of software on a typical development machine, and often different versions of Ruby, different gemsets, etc. This Bash prompt will tell you the pertinent information at a glance right on your Bash prompt.
Getting Started With Rails Views
How do you get data from your model into your HTML output? Your controller requests it and give it to the view. Views themselves are rather simple, as you'll see, being most HTML with a sprinkling of Ruby.
XSS (Cross-Site Scripting) Vulnerabilities in Ruby on Rails
The Rails developers take security seriously. Though XSS (Cross-site scripting) vulnerabilities are largely mitigated, you still have to worry about them.
CSRF - Cross-site Request Forgery
Your admin clicks on a link and suddenly your site is down. The admin didn't do anything wrong, they just clicked on a link. Someone just used a CSRF attack on your site, a very potent and easy attack to carry out. Rails has this mostly mitigated, but you really need to know about this type of vulnerability.
The router is what stands between HTTP requests and controllers and actions. The router is an integral part of any Rails application.
An Introduction to Rails: a Quick Blog Part 3
In this third part we finish off the Rails blog.