Heads up! To view this whole video, sign in with your Courses Plus account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this video, we generate our Ruby on Rails application. We make sure we have the latest version of Rails installed, and generate the new app.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[Master Class] [Designer and Developer Workflow] [Generating the Project]
0:00
So, I just got done with my planning meeting with Nick,
0:06
and he's going to start working on some wire frames, but what I want to do
0:08
is get him some real code as soon as possible.
0:11
So, what I'm going to do is set up a get repository
0:13
so we can share code between each other.
0:15
And then I want to actually create the Rails application and generate the jobs model
0:18
and views so he can start working on them.
0:21
So, let's get to it.
0:24
What I need to do is figure out right now what I need to do and in what order,
0:26
because right now, Nick is in the process of beginning his design work in parallel.
0:30
So, there are some things that I need to get done soon so Nick can begin doing his work.
0:34
Namely, I know that Nick likes to design in actual views in the page.
0:39
He doesn't really spend a whole lot of time working in Photoshop
0:43
and really works on creating his own HTML as he goes.
0:46
Now, he can do that in his own HTML files, but really it's going to be a lot better
0:50
if he has a Rails scaffold to work on so he can just work directly in the views.
0:55
So really, my priority here is to get the project set up and to be able to get him the project
1:00
with some views that he can begin working on.
1:06
So, our first course of action is going to be to generate the Rails project.
1:09
After that, we need to set up Git.
1:14
Now, I'm going to be using GitHub to store our repository,
1:18
and then Nick can push and pull from GitHub, and I can push and pull from GitHub,
1:21
and that's how we'll keep our code in sync.
1:25
So, I need to go to GitHub and set up a new project and get it set up so we can
1:28
push into that project, and then I'll be sending Nick the details so he can get set up
1:32
and pull on the project as soon as possible.
1:36
Then I want to go ahead and generate a scaffold for our jobs.
1:40
And we decided in this iteration we really just want to be able to post jobs
1:48
and be able to view them from the client side.
1:51
So basically, for Nick to be able to do his job, he just needs to be able to have
1:54
the index view and the show view for the job, and then an interface
1:58
so he can set up test data in his local account.
2:02
So, the first thing we want to do is, let's go ahead and just generate a new Rails project.
2:06
But first, we need to make sure we have Rails installed.
2:10
So, what I'm going to do first is install Rails.
2:13
So, we'll just do sudo gem install rails.
2:17
This will take a little while to install Rails, so we'll just skip ahead.
2:20
And we're done.
2:31
So, I'm in my projects directory, and let's go ahead and generate our Rails project.
2:33
So, let's take a look at the options that we can do for Rails
2:39
and see if we want to specify any of them when we generate it.
2:41
So basically, our options here are to work with what database we want to use,
2:50
and I think ultimately, we're probably going to deploy onto Postgres,
2:55
but for our development purposes, I'm going to work with the default SQLite3,
2:59
and this is because it's just really easy to set up.
3:03
It's just a local file, and it's going to work for us.
3:06
We shouldn't need to do anything advanced that would require us to really
3:09
step out of the database agnostic part of active record,
3:13
so we can use really any database that we want.
3:17
So, the other thing we are probably going to go ahead and skip are the prototype files,
3:20
and these are the JavaScript files right now included by default with Rails.
3:25
We're going to be using jQuery, and jQuery in Rails 3.1 would be the default,
3:28
but right now, prototype is the default, so let's go ahead and skip those,
3:33
and we'll be adding in the jQuery parts momentarily.
3:37
So basically, to create a new Rails project, we're going to type in
3:41
"rails new" to generate the project, and let's give it a name.
3:45
We'll call it "easyjobs," and we'll pass in "- J" to skip the prototype files.
3:49
So, let's see what happens when we do that.
3:56
So, it's gone ahead and created everything, and if we look at our files,
3:59
we'll see there's an easy jobs directory, so let's just jump into that.
4:02
So, if I clear this out and we take a look inside, we have a Rails project.
4:08
Now, I'm going to go ahead and open up the Rails project in my text editor TextMate.
4:12
Now, here we have our Rails project set up and ready for us to use,
4:18
and it looks pretty good.
4:22
We can look into our public directory inside JavaScripts,
4:24
and we can see that the prototype files are not there.
4:28
We just have a basic application.js, and we'll be setting up our defaults later.
4:31
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up