Learning Ruby on Rails for the Non-Developer

Official Ruby logo
Image via Wikipedia

So, @hamptonsrob asked me to put together a Ruby on Rails for non-developers getting started post.  I’m a little hesitant to do this because I am a non-developer and I am learning and I’m completely on my own with this and don’t have anyone to ask questions so if something breaks (which it did yesterday in a gem version) I’m at a dead end and you will probably make the same mistake if you follow my instructions.

So a couple things I’ve learned.

1. get a book (I have the Ruby on Rails Bible by Timothy Fisher)….read the first chapter or two, then put it aside for about a month.  The reason for this is that most books are out-dated and an experienced developer may realize what parts are out-dated and tell you it’s no big deal, but for the non-developer it’s a big issue.  example: every book highly recommends you use the Heroku UI.  They show pictures, tell you how great it is and proceed to use it as the platform for the first chapter or two.  Guess what? HEROKU DISCONTINUED THEIR UI!!!!!!! And yes, I spent about 2 weeks looking around Heroku’s site and searching around the internet for this.  Heroku doesn’t even have the courtesy to tell you they discontinued it!

2. Get used to the command line.  I knew nothing about this.  Some basic tips (by the way the $ is already always there, you never have to type it, so if you don’t see it there, for example if you are in windows and don’t see one, just make sure you’re working on the C:/ directory [which doesn’t apply to mac]):

$ cd   means change directory.  If you type cd into a command line it takes you to the base directory.  If you create a rails app and then need to navigate to it and it’s call for example ‘mobtown’, you would type $ cd mobtown and then the computer will change your command line to the right directory and then you can write commands to files in that directory.  If you don’t do that, you could know all the scripts in the world and you’ll be sitting in the wrong directory.  Here’s an example:

(my computer is called US136119 and my login is admin)

I open up the Terminal and see:

US136119:~ admin$

after that I type:  cd mobtown

the computer returns a new prompt:

US136119:mobtown admin$

3.  Get a mac.  And get TextMate.  There are tons of text editors out there and it’s just as easy to program in Ruby on Rails on a PC but all of the tutorials are on macs and for a non-programmer who doesn’t know how to weed out the extra info or random programmers stuff that all programmers know, you want to be working on exactly what everyone else is working on so you have less chance for screwing things up.

4. Ok, you’ve got your mac, you know some basic command line understanding.  Next, a huge issue when I got my mac that again set me back about a week….most commercial MacBook Pro’s come shipped without access to the root directory enabled. You need to give yourself access to the root directory.  If you don’t have that you can’t use the command sudo or access certain places.

5. Installing Ruby and Rails.  Most mac’s have both already on them, but ignore that.  You go to this link and follow the stuff for Leopard 10.5 because you just bought a new mac and that’s what it has so ignore everything else.  

http://wiki.rubyonrails.org/getting-started/installation/mac

6. Ok, now you’re ready to make your first app.  You have a mac, you’ve updated Ruby and Rails, and you’ve gotten TextMate (just get the free trial for now).  Now you’re about $2,000 in the hole and haven’t produced a thing but you’re on your way.  So here’s when you start getting some satisfaction.

Open the terminal.

type this (mobtown is the name of your app, you can name it whatever you want. note that all you type here is ‘rails mobtown’ then the computer spits out a ton of file names that it’s created):

US136119:~ admin$ rails mobtown

      create  

      create  app/controllers

      create  app/helpers

      create  app/models

      create  app/views/layouts

      create  config/environments

      create  config/initializers

      create  config/locales

      create  db

      create  doc

      create  lib

      create  lib/tasks

      create  log

      create  public/images

      create  public/javascripts

      create  public/stylesheets

      create  script/performance

      create  test/fixtures

      create  test/functional

      create  test/integration

      create  test/performance

      create  test/unit

      create  vendor

      create  vendor/plugins

      create  tmp/sessions

      create  tmp/sockets

      create  tmp/cache

      create  tmp/pids

      create  Rakefile

      create  README

      create  app/controllers/application_controller.rb

      create  app/helpers/application_helper.rb

      create  config/database.yml

      create  config/routes.rb

      create  config/locales/en.yml

      create  db/seeds.rb

      create  config/initializers/backtrace_silencers.rb

      create  config/initializers/inflections.rb

      create  config/initializers/mime_types.rb

      create  config/initializers/new_rails_defaults.rb

      create  config/initializers/session_store.rb

      create  config/environment.rb

      create  config/boot.rb

      create  config/environments/production.rb

      create  config/environments/development.rb

      create  config/environments/test.rb

      create  script/about

      create  script/console

      create  script/dbconsole

      create  script/destroy

      create  script/generate

      create  script/runner

      create  script/server

      create  script/plugin

      create  script/performance/benchmarker

      create  script/performance/profiler

      create  test/test_helper.rb

      create  test/performance/browsing_test.rb

      create  public/404.html

      create  public/422.html

      create  public/500.html

      create  public/index.html

      create  public/favicon.ico

      create  public/robots.txt

      create  public/images/rails.png

      create  public/javascripts/prototype.js

      create  public/javascripts/effects.js

      create  public/javascripts/dragdrop.js

      create  public/javascripts/controls.js

      create  public/javascripts/application.js

      create  doc/README_FOR_APP

      create  log/server.log

      create  log/production.log

      create  log/development.log

      create  log/test.log


7. OK! now you’ve created a Ruby on Rails app but nothing will work yet because you haven’t turned the server on so you now need to switch to the directory for your app and it will re-set the prompt with the mobtown directory indicated:

US136119:~ admin$ cd mobtown

US136119:mobtown admin$ 

Then type in :

US136119:mobtown admin$ script/server

=> Booting Mongrel

=> Rails 2.3.5 application starting on http://0.0.0.0:3000

=> Call with -d to detach

=> Ctrl-C to shutdown server

Now if you go to a browser and type in http://www.localhost:3000 your app will come up with a Rails default page.
Ok, you now have something going.  I have taken you up to step 4 of this tutorial.http://wiki.rubyonrails.org/getting-started/first-rails-app-walkthrough
8. Now it’s time to hit Ctrl-C to shut your server down and go to this site and take a break….don’t even move forward with the tutorial yet, you need to understand a bunch of stuff.  Now go to this site and listen to the Audio posts 1-8 and then stop.
http://www.buildingwebapps.com/podcasts
9. Now it’s time to go back to where you left off after  you’ve listened to all of the Audio posts.  Now go back to the Rails Wiki Tutorial that got you to script/server and start at #4 and complete that entire tutorial.  One note on this.  They reference file directories.  Whenever they do that you want to do this (after you’ve installed TextMate of course):US136119:mobtown admin$ cdUS136119:~ admin$ cd mobtownUS136119:mobtown admin$ mate .
That will open up that Rails Application that you made in TextMate so you can browse through the files.  I point this out because for the non-developer it gets a little confusing as to what you should do in the command line (terminal) and what you should be doing in TextMate.
http://wiki.rubyonrails.org/getting-started/first-rails-app-walkthrough
10.  Ok, now that you’ve done that you’re ready for the Video Tutorials.  Go back to the Learning Rails site and do all of the Video Tutorials.
http://www.buildingwebapps.com/podcasts


That’s all I’ve got for now.  I wouldn’t mess around with Git or Heroku or external servers or any other database formats yet. I did some of that stuff and it was a big time drain and I spent more time figuring out something that I didn’t need to know quite yet.
Anyway, good luck and feel free to correct me if any of this is wrong, or you disagree with it, or you run into any problems but this seemed to work so far for me.

Reblog this post [with Zemanta]
Comments
blog comments powered by Disqus
  1. mobtownlabs posted this