Introduction to “Learning Rails the Hard Way”

March 31st, 2009

Like many of you, I have a REALLY GREAT IDEA FOR A WEB APP. OK, first, sorry for the caps, they turn me off too. The caps were just demonstrative of the emotion and energy we feel when we think about making something really cool and envision it working, howbeit far off in the future or in consideration of the days, or weeks, or months of toil needed to make our vision a reality. Many of us (coders, hackers, pick your label) have some ideas that we’ve just got to make happen. I’ve got some web app ideas, tools I want for myself. I’ve done a bunch of brainstorming and design and investigating what to use to implement.

Web development, hmm… lots of choices there. I’ve done a fair amount of Java based web development professionally, mostly the back end stuff with occasional front end coding and troubleshooting when the web designers and front end coders needed the help.  I’ve done enough systems level Java programming that I wanted to chose something else, anything else just for the experience. So given all the options and weighing many obvious candidates, I settled for the most obvious, Ruby on Rails.

Having read a good deal of hype on Rails, I decided to give it a try and get a better working understanding of the framework. In part to judge it objectively for its effectiveness (in theory at least) and if it lives up to some of its hype, to be able to rapidly build out and tailor my web apps to see if they actually do what I envision them doing.

There’s just one little catch, I’ve got to actually get a much better understanding of the Rails framework, and that is not a rapid development experience.  A good part of the reason is just my nature. When I don’t have an intuitive grasp of something, I hunker down and turn into Mr. Methodical Guy, going step by step until I can draw from point A to point B and so on until I feel that I know the boundaries of where this something will flex, bend, or break. Then I get the warm feeling that I understand enough that I can turn intuition back on and cruise through my work.

So it is with Ruby on Rails and me. I’m logging my learning experience, and am rolling out posts on the more interesting parts, or at least the little a-hahs! I find as I beat my head against the wall going down dead ends until, when I have exhausted all other alternatives, I do it “the right way.” I’m contemplating calling this series, “Don’t follow my example or How to learn Rails by doing it the wrong way first.”

Don’t forget RailsEnv in Rails development mode

March 22nd, 2009

I’m teaching myself Rails and my development server configuration  is

  • Debian Etch
  • Apache 2.2 mpm prefork
  • Phusion Passenger 2.1.2
  • MySQL 5.0
  • Rails 2.3.2
  • Ruby 1.8.7

I’m running name based virtual servers and moved my Rails application project over from my desktop. No joy. I kept getting the following page when I try to view the app:

We’re sorry, but something went wrong.

We’ve been notified about this issue and we’ll take a look at it shortly.

I started up the Mongrel server. Fine, worked like a champ. What was wrong? After some digging around, ruling out my Rails setup and my app. Routes ok, permissions ok. I went back to the Passenger documentation. , and found the  key: RAILS_ENV.  Passenger looks for “production mode” by default. As I am developing,  I have my configuration set for development mode. If you want Passenger to run your app in development mode, you need to specify it somewhere. The docs say you can specify it in a number of places. I chose my virtual host file.  I inserted the little gem (pun intended) into my virtual host file, as follows:

<VirtualHost *>
ServerAdmin admindude@homenet
ServerName  sandbox.homenet
ServerAlias sandbox
DocumentRoot /home/www/sandbox/public
RailsEnv development

</VirtualHost>

I restarted Apache, and the Rails app page came up nice and dandy. We were golden.  We were so happy we did the dance of joy.

Back to work.

New blogger, new blog

March 5th, 2009

Hello World,

I don’t expect many people to read this first post. A couple of years ago, I decided it was time to leave anonymity behind, shed my web seclusion and start to share some of my experiences and ideas, for better or worse. Well, a couple of years have passed. Day to day life seemed to conspire, always pushing my writing to the back burner. I’ve accumulated a good deal of material, so will now make an effort to share, to add to the ever increasing din of voices on the web. I also have some ideas to help sift through the multitude of content and lower the noise to signal ratio, just a bit. So stay tuned and I’ll do my best to add some substantive content.