Ruby on Rails – My First Attempt
There is a lot of talk about Ruby on Rails and I decided to give it a try. I have zero experience with Ruby on Rails or the Ruby programming language. If it can speed up the development of web apps then it will be a great language to learn. This post is the first in a series of my attempts to learn RoR. What you will find below are my notes as I attempted to get it setup on a Windows 7 machine. I can say that this initial setup process was frustrating.
——————————————————————————————————————–
I went to the Ruby on Rails site, http://rubyonrails.org, found the “get started” arrow to download version 2.3.8. Before I got that far I see there is a lot of talk about the new rails 3.0 and it is very close to being released. As it will take me quite some time to learn and develop an app I want to use the latest version. I went ahead and clicked on to download version 2.3. I researched some and read and it seems Ruby version 1.8.7, does not work so well with rails 3.
I downloaded and installed the Ruby installer for Windows with version 1.9.1-p378, from – http://rubyforge.org/frs/?group_id=167
It then installed Ruby in the drive, c:\Ruby191 and I selected for it to add ruby executables to your path and associate .rb and .rbw files with this ruby installation.
The ruby site then says to install RubyGems – the package manager for ruby. I followed the link and downloaded RubyGems 1.3.7. After that is says to extract, then run “ruby setup.rb”. I would be assuming I do this from the windows command line, from the directory I extracted it to. I did this and it appears to work. It said RubyGems installed the following executables: c:/Ruby191/bin/gem
Now with RubyGems installed I should be able to install all of rails and its dependencies by command line. I don’t want rails 2 though I want rails 3. Right now it is at rails 3.0 beta 4. To install the latest I run, “gem install rails –pre”. So I ran this and it held there on the command line for a minute or so then it started installing items and then it came back with an error. “ERROR: While executing gem … (Errno::EINVAL) Invalid argument – ./</cdesc-<.yaml”. I think this is because I need ruby 1.9.2, in search of help now, in the way of the irc channel.
The error is just for some documentation that did not work, so I am going to bypass that and proceed with 1.9.1.
I created a projects folder in my documents on windows and then went in to that directory on the command line and created my first rails app. “rails app1″. I had to use “rails new app1″ for it to work. This created the files and folders for the app.
Now to test to see if I can access the site on my local browser. I am having trouble getting the WEBrick server to load. Not sure what I got to on the command line but it recommended to run “bundle install” so I did. That did not fix the problem though.
It was telling me that it could not find the sqlite3.dll files. I had to get the files from http://sqlite.org/download.html and put them in the ruby191/bin folder.
After I did that I ran “ruby script\rails server” and it worked and I was able to load the site in the browser.
