|
Speaker: Chris Williams
Intro to using Aptana RadRails.
|
Welcome to Aptana. My name is Chris, and today I'm going to show you how to get started
with Aptana RadRails. You can install Aptana RadRails directly from our Aptana start page.
You notice in the center, there's a plugin section with Adobe AIR at the top. If you scroll
down, you'll see the Aptana RadRails link to install. Once you click this link, it'll bring
up a dialogue show you the plugins. Check the box and click Next to grab those plugins.
It'll download the plugins you need and then ask you to verify that you'd truly like to
install this. Click the Install All button, and it'll extract all the files you need into
your Aptana install. When it's finished, it'll ask if you’d like to restart. Click Yes.
And when Aptana reloads, it'll have the Aptana RadRails plugins installed.
You notice, when you come back, you're still in the Aptana perspective. This is the perspective
you use to edit CSS files, java script, HTML; but to work with Rails, we're going to have to change
to the RadRails perspective. To do that, we click this button in the upper right labeled
Open Perspective, and choose RadRails. Now you'll notice that we have a brand new
perspective and a whole new set of views that are tailored to Rails development.
But before we get started, we're going to check our preferences to make sure that Aptana RadRails
has the right settings for our Ruby interpreter and our Rails installation. To do that, we go to
Window > Preferences..., and we're going to look at the Ruby preferences first. Choose
Installed Interpreters, and it'll show us what interpreter or Ruby installation that
Aptana RadRails has automatically detected. In most cases, this'll be fine for most users. If you
have multiple installations of Ruby or you happen to want to choose a particular installation, you'll
want to go in here and change and edit this installed interpreter or add a new one. From here, you'll
see all the settings for the particular interpreter. Typically, all you'll do is change this Ruby home
directory to the base root installation of – Ruby install.
That looks fine, so we're gonna move on. There's also a Rails configuration section. In this section,
you can configure your path to Rails and to Rake. In most cases, you actually won't have to enter
anything here, and that's why these are blank. Aptana RadRails will try to automatically detect where
the Rails and Rake installations and scripts are. If you ever see problems with Aptana RadRails generating
new Rails projects or running Rake tasks, this is where you'd manually override the path that Aptana RadRails
is trying to use.
So now let's get started, and we're gonna create a new Rails project. To do that, you right click in the
Rails navigator. Click New > Rails Project. We're going to enter in a new project name, and from
here you have a few options in generating your application. You can generate the skeleton. You can choose
one of two servers to create, and you can disable table colorization. We're going to create a mongrel server,
not a WEBrick server, and we're gonna continue to generate the skeleton
You'll see the project's now appeared on the left-hand side on the Rails navigator, and we also see the output
of the Rails generation process in our console view. This is the same sort of output and the same generation
that would happen on a command line.
We've also created that mongrel server there, which shows up in our servers view. So to get started, we're
going to edit our database .yml file, and I'm going to use SQL Lite-– just to speed things up.
Okay. Now we've got our database .yml file set up. So now what we're going to do is generate a
scaffold resource. So we switch to the generator view, and then from the pull-down, we pick
Scaffold Resource. I'm going to generate a tag model, and I'm going to give it a single field
name, which is going to be a string. So you can hit Return or you can click Go,
and that'll fire off the generator. Now, again, the output will be shown in the console view, and
it's really just doing the same thing–- wrapping your Rails processes, and you can see all the generated
files there. You can also see them over in the Rails navigator view now. You've got a tag model, tag
controller, you've got views. And we should also have a nice migration for this model.
Now, what we're going to do is run the migration; so we go to our rate tasks, and from the pull-down,
we pick DB Migrate, click Go, and, again, we'll see the output on the console view. And
there we have it. We have our table created, and since this is SQL Lite, it generates the database on demand.
Now, we're ready to start playing with our app. So we can go to the Servers View, right-click, and choose
Launch Browser, and that'll open up the browser to our application. If the server's not already running,
RadRails will ask you if you want to start the server first. So we'll tell it to start the server, and you can
see the console output here. We're running a mongrel server, and it opens a nice internal web browser for you to
your application. So here's our ubiquitous start page, and we're gonna go over to the tag controller just to show
you that we've got it all set up and scaffolded. And we'll create a nice, new tag.
And there you have it. We have our Aptana RadRails all set up, ready to go, and we've got a nice, brand
new project with a scaffold for tags. So we're ready to start developing an Aptana RadRails.
[End of Video]
|