Introduction and Installation5:27 with Jim Hoskins
In this video we indtroduce the Ruby on Rails framework, and install it onto our computer.
[?mellow guitar music?] 0:00 Think Vitamin Membership - Est. 2010 membership.thinkvitamin.com 0:03 Ruby on Rails - Introduction and Installation with Jim Hoskins 0:07 Ruby on Rails is a web application framework used by tons of sites on the net, 0:13 like Twitter, hulu, Get Satisfaction, Basecamp, and many more. 0:17 In this chapter, we're going to show you how to get started developing 0:21 on Ruby on Rails. 0:24 Ruby is a programming language. 0:26 It's the basis of the Ruby on Rails framework. 0:27 This chapter, I will not be going into depth on the details of the language, 0:30 so if you're totally unfamiliar with Ruby, I recommend you check out 0:34 the Ruby videos from Think Vitamin Membership. 0:37 I will be explaining little parts of the language as we go along, 0:40 but this is by no means an in-depth tutorial on Ruby. 0:43 Rails, however, is a framework, or a set of tools built in Ruby 0:46 that allow you to build web applications quickly 0:50 without having to worry about subleties of things like http servers. 0:54 The version of Rails we're going to be using is version 3. 0:57 Now, Rails focuses on a few core ideas, 1:01 like Rapid Development. 1:04 Rails allows us to have a rough version of our application running 1:06 in just a few minutes. 1:09 From there, you can iterate and improve on your code 1:10 to create the functionality and the interfaces that you ultimately want to have. 1:13 The ability to iterate quickly allows you to 1:18 make sure that you're on the right track in your development. 1:20 Convention over Configuration 1:24 Rails is designed to get you up and running quickly, 1:25 so in almost any situation, there is a convention for 1:28 naming parts of your code, or where you put your files, 1:31 or just the general structure of your code. 1:34 You can always override the defaults when the conventions and defaults aren't ideal, 1:36 but having the defaults there makes it easy to get up and running 1:39 in your web application quickly. 1:43 Additionally, since there are so many conventions and defaults, 1:45 most Rails applications follow a similar pattern of development. 1:48 This means that you can jump around from project to project, 1:52 or even jump into an existing Rails project 1:55 and already pretty much have a good idea of where all the code is going to be. 1:57 Testing 2:01 Now, testing is built right into Rails and everything it does. 2:03 It not only provides a full test suite, but the option 2:06 of several excellent other test suites that work equally well. 2:09 Anytime that you generate code, 2:13 test code is also generated right along with it 2:15 and there are a lot of great tools that allow you to do things, 2:18 like test-driven development, in which you write your test first and build your application 2:20 to meet those test criteria. 2:24 When we want to get Rails installed, the first we need to have is Ruby. 2:26 You can see how to get Ruby and Ruby Gems installed 2:30 by watching the "Getting Started" and "Ruby Gems" 2:33 video of the Ruby course on Think Vitamin Membership. 2:36 Now we're going to be installing Rails version 3. 2:39 Rails 3 requires Ruby 1.8.7 or higher, or Ruby 1.9. 2:42 We can check our Ruby version by typing in $ruby -v 2:47 and we can see I'm running Ruby 1.8.7. 2:52 Next, we need to install Rails, and we do that like any other Gem 2:56 by typing in $sudo gem install rails. 2:59 Once it's done installing, we can bring back our prompt 3:03 and we can check that we have the latest version of Rails by typing in $rails -v. 3:06 And so we can see we successfully installed Rails version 3.0.0. 3:12 Based on when you installed this, your number might be different 3:17 because when you install Rails, it'll always install the latest version. 3:20 You can keep up to date on Rails by going to rubyonrails.org 3:24 and it'll show you the current version as well as specific instructions 3:27 for downloading onto your system. 3:31 Now, for documentation, there are a couple of different options. 3:33 You can visit api.rubyonrails.org, 3:37 which is the default API page for everything in Rails. 3:40 It's a pretty good system--it certainly has all of the documentation you'll need, 3:43 but it's a little bit disorganized for my liking. 3:48 A tool that I like to use is called railsapi.com. 3:51 You can either download it for local use or browse the online version. 3:55 Right now I'm on the Rails 3.0 release candidate site, so if I were to browse online, 3:59 we get this nice little interface here. 4:04 Now, it has all the same content, but the layout is different 4:06 in that you get this nice live search here where you can type in 4:09 the name of a method or a class, 4:12 and it'll search it for you instantly 4:15 and you can see all the same documentation. 4:18 It's all the same documentation, but I find that Rails API is more discoverable 4:20 and easier to use than api.rubyonrails.org. 4:24 Another popular option is apidock.com/rails, 4:28 and of course, this has the same documentation, 4:32 but a couple other nice features. 4:34 Now, it doesn't have the big list of classes and methods, 4:36 but it does have a live search, so we can type in "validates" 4:40 and sometimes it doesn't quite find the one you're looking for immediately, 4:44 so we just hit enter, and it takes us to the page, 4:47 and you can see that it has all the same documentations. 4:52 Some other nice things about it is that it gives you a history 4:55 of the particular methods, so you can see this was introduced in Rails 3.0. 4:58 Other methods you'll be able to see its availability and previous versions, 5:02 which is nice, as well as the ability for people to comment 5:05 and leave extra information on the methods, 5:08 which is really handy. 5:11 So between these 3 tools, you should have some great documentation 5:12 for reference when working with Rails. 5:15 In the next video, we're going to start building our first Ruby on Rails application. 5:18 [?mellow guitar music?] 5:22 Think Vitamin Membership - Est. 2010 membership.thinkvitamin.com 5:24
You need to sign up for Treehouse in order to download course files.Sign up