Steaming Up The Engine for The Rails

I’ve been digging through and playing with the Rails Framework now for about 4 months with intent (I guess I’ve read about it, learned about, but not played with it for well over 4 years). I’ve gained a pretty good familiarity with the parts of the framework. Below, I’ve laid out some of the key things that I’ve done over and over just to become familiar with the commands, organization, and other elements within the framework. These also, in this specific order, is what I’ve found works best for getting a Ruby on Rails Application Project kick started (on a *nix based machine, the rvm commands will however not work on Windows, you’ll need to find a respective replacement).

…click through to read more…

Ruby on Rails Hittin’ The Big Time, A Friday PSA

How do you know that Ruby on Rails has already hit the big time? Not that it needs anymore proof that it is absolutely one of the MAJOR platforms available right now…

Recruiters now regularly come to user groups & offer to “buy the beer” afterwards.
The split of job searches on sites now easily come up with dozens upon dozens of Ruby on Rails Jobs.
Enterprise & Other Managers are commonly asking what the “Ruby on Rails Dev Base” looks like. In other words, they want to know who and how many people they can hire.
Anyway that you look, you’ll see Ruby on Rails making inroads at a company near you! Keep your eyes peeled, and if you aren’t polyglot now, you might want to start thinking about it.

Cheers! Happy disruptive markets to you! 😀

Keeping Your Rails Projects Organized Right!

I’ve been working with Rails now for about 3 months. At first I jumped right in like a bull in a china shop. I have since, suffered the frustration of doing so. I’ve experimented on OS-X, Windows, and Linux (primarily the Ubuntu Distro). Among these three operating systems, getting up and running with rails is a breeze. Sure, I’ve wrecked more than a few apps I started, blown to smithereens a few machine images, and been generally destructive – but that’s not a bad way to learn at all. 😉

Through this trundling, I’ve come to find there are a few things that should be reviewed and learned thoroughly before smashing into the china shop (i.e. rails or Ruby for that matter). One of these tools is RVM. Another is Git. These tools, without doubt or question, you MUST LEARN! There is just too much value in both of these tools to try to ignore either one. First a quick description of each:

Git – Git is a source control server and respective client software.

RVM – Ruby enVironment Manager – RVM, sometimes referred to as the Ruby Version Manager also, is a way to maintain the various gems and other environment settings that are used for a particular project. It enables switching back and forth between versions of ruby, keeping ruby updated, and much much more. In .NET, think of it as choosing which version of .NET to use, except with more power to go beyond just merely choosing which version. These two tools are pivotal in having a smooth, consistent, and understandable workflow. There is one other issue for Windows users here though, RVM does not and will not ever run on Windows. One can however install cygwin to get it running or they can use Pik.

“Working Directory doesn’t exist” in Rubymine! ARRRGGGHHH!!

So a few weeks back I created a Rubymine Ruby on Rails Project I was kicking off. I got it running, did some scaffolding, started customizing that for what I needed. I had created this project on Windows 7 and did not realize the implications of this. I did a clone via github of the code on a Mac via bash. I then opened Rubymine and opened the project. That’s when I got this error message, “Working Directory doesn’t exist”. I thought, well what the… no reason for this. I’ve barely edited the project.

I checked out the Jetbrains Forums and didn’t find an answer at the time, but did find others having the problem. Just today, Tyler Williams posted what had happened. Being that I don’t delete my projects, even slightly broken, for many days I went back to look at the .idea files as Tyler Williams suggested. Sure enough, my setting was hard coded (I suppose by the IDE??).

Which leads me to my recent thought that maybe I’ll be using TextMate more and Rubymine a little less. Even though, I do love the refactorings, code completion, and all that. But since I’m in the learning stage, and I’m doing hard core TDD (best I can with Ruby 🙂 ) I ought to not use the IDE as a crutch and instead force myself to learn the language well & the Rails Technology Framework! I’m getting there, but the battle still exists for me. At this point, I do my Ruby & Rails work about 1/2 in TextMate and 1/2 in Rubymine.

Anyway, if you run into “Working Directory doesn’t exist” in Rubymine, now you have a good lead on what to do.

Last Night’s Cafe Racer Ruby on Rails Meetup; Kilt Lifter, EngineYard, Heroku and a Ruby Tone

This evening at the Cafe Racer Ruby on Rails meetupI knocked out these specific tasks.

Kilt Lifter by Pike Brewing Company
Drank a solid tasty Kilt Lifter.
Created a sample beginning application, with standard migrations, and errata, and made two simple models with respective scaffolding.
Deployed the beginnings of a sample application to Heroku.
Deployed the beginnings of a sample application to EngineYard.
For Kilt Lifter information, click on the image at the right. If you live in the northwest, you know what’s up with the beer capital of the world (i.e. Portland, and the northwest in general, for info see here). We love our beer up here in these parts, we love it with a passion and it shows with more brewpubs, beer options, varieties, home brews, and other flavors than anywhere else in the world. No, I did not mis-state that, the northwest has more than anywhere else in the world, almost by an order of magnitude! More than Germany, Ireland, England, the East Coast of the US, and the list goes on. So if you’re up for a beer and some coding, or just a beer, head to the northwest! We’ll have a few for ya to taste. 😉

The initial Ruby on Rails Application I created I started with RubyMine from Jetbrains. Simply a File -> New Project -> Rails Application, etc, etc. I worked through some of the issues with fellow rubiests and railers at the meetup. We did run into a confusing and nasty issue with Postgresql. Why was I installing Postgresql you ask? Well I was trying to do a deployment to Heroku, which provides a free shared instance of postgresql. I gotta admit, of all the things that Heroku makes absurdly easy, setting up a database is not one of them. Maybe I’m missing a bit, but I don’t know what the instance of the server is, what the username or password is, or anything of that sort. It isn’t all that intuitive that you have to add the database as an add-on either. At least, it wasn’t to the 3-4 of us that were working on it.

The other problem I ran into was what process I should actually use to install Postgresql. The firsts thing I tried to do was submit the “gem install pg” which ended with a completely wonky description. The error message read as:

[sourcecode language=”bash”]
$ sudo gem install pg
Building native extensions. This could take a while…
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install pg
extconf.rb:1: command not found: pg_config –version
ERROR: can’t find pg_config.
HINT: Make sure pg_config is in your PATH

[/sourcecode]
I found a fix, here put together by Graham Ashton. Thanks Graham!

Meanwhile I dived into EngineYard and got the application up and running in short order. I have to say I am much impressed by the increased visibility into what’s going on with EngineYard. Heroku seems to hide just a bit too much. Add to that their over-reliance on AWS East and not geographically dispersing the platform, I’m leaning even heavier on suggesting EngineYard for startups and companies that want a cloud provider platform to build to.

Once the applications I’ve been working on get to a certain state, I’ll be providing a write up regarding the applications. However, until then, feel free to follow me on Twitter and Github or jump in fork my code and send me a pull request. 🙂

Kilt Lifter by Pike Brewing Company
Drank a solid tasty Kilt Lifter.
Created a sample beginning application, with standard migrations, and errata, and made two simple models with respective scaffolding.
Deployed the beginnings of a sample application to Heroku.
Deployed the beginnings of a sample application to EngineYard.
For Kilt Lifter information, click on the image at the right. If you live in the northwest, you know what’s up with the beer capital of the world (i.e. Portland, and the northwest in general). We love our beer up here in these parts, we love it with a passion and it shows with more brewpubs, beer options, varieties, home brews, and other flavors than anywhere else in the world. No, I did not mis-state that, the northwest has more than anywhere else in the world, almost by an order of magnitude! More than Germany, Ireland, England, the East Coast of the US, and the list goes on. So if you’re up for a beer and some coding, or just a beer, head to the northwest! We’ll have a few for ya to taste. 😉

The initial Ruby on Rails Application I created I started with RubyMine from Jetbrains. Simply a File -> New Project -> Rails Application, etc, etc. I worked through some of the issues with fellow rubiests and railers at the meetup. We did run into a confusing and nasty issue with Postgresql. Why was I installing Postgresql you ask? Well I was trying to do a deployment to Heroku, which provides a free shared instance of postgresql. I gotta admit, of all the things that Heroku makes absurdly easy, setting up a database is not one of them. Maybe I’m missing a bit, but I don’t know what the instance of the server is, what the username or password is, or anything of that sort. It isn’t all that intuitive that you have to add the database as an add-on either. At least, it wasn’t to the 3-4 of us that were working on it.

The other problem I ran into was what process I should actually use to install Postgresql. The firsts thing I tried to do was submit the “gem install pg” which ended with a completely wonky description. The error message read as:

[sourcecode language=”bash”]
$ sudo gem install pg
Building native extensions. This could take a while…
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install pg
extconf.rb:1: command not found: pg_config –version
ERROR: can’t find pg_config.
HINT: Make sure pg_config is in your PATH

[/sourcecode]
I found a fix, here put together by Graham Ashton. Thanks Graham!

Meanwhile I dived into EngineYard and got the application up and running in short order. I have to say I am much impressed by the increased visibility into what’s going on with EngineYard. Heroku seems to hide just a bit too much. Add to that their over-reliance on AWS East and not geographically dispersing the platform, I’m leaning even heavier on suggesting EngineYard for startups and companies that want a cloud provider platform to build to.

Once the applications I’ve been working on get to a certain state, I’ll be providing a write up regarding the applications. However, until then, feel free to follow me on Twitter and Github or jump in fork my code and send me a pull request. 🙂