Rails 3.0 on Heroku after trying Rails 3.2

So I was playing with Rails this weekend making all sorts of progress until I tried to get it running on Heroku. Everything worked fine locally but a variety of errors plagued me up on the servers.

I figured out 4 main issues i was having

  • Bamboo stack instead of Cedar
  • Rails 3.2 instead of 3.0
  • Forcing a push to Github
  • sqlite3 instead of pg

First off I had updated to the latest Rails version but it seems you need to jump through hoops on Heroku if you want to use the latest and greatest. I also looked at using 3.1 on Heroku but this also wasn’t out of the box. So I opted for the tried and true Rails 3.0 on Heroku/Cedar.

Bamboo stack instead of Cedar

When I setup my app this weekend I just used the default Heroku Create syntax. Many of the tutorials neglect to include the –stack option. So after I figured out I wanted to be on cedar instead of bamboo I created my application  on Heroku using:

$ heroku create --stack cedar

Rails 3.2 instead of 3.0

The only problem was I had updated my local rails version to 3.2 and now I need to roll back to version 3.0.

Well I didn’t need to, I could have used the gem _version_ convention. Specifically the Gem setup has a wrapper for executables like rake and rails. That executable supports a _version_ parameter to specify a particular version . I could have used: $ rails _3.0_ new myProject all the time, but that’s just more things for me to forget and I really just wanted a base setup.

The first thing I needed to do was get Rails 3.0 installed. For that I called:

$ gem install rails --version "3.0"

Once installed 3.2 was still being used so I uninstalled it:

$ gem uninstall rails

Since I had two copies installed at this point it asked me which to uninstall, I choose 3.2

Unfortunately my project was already setup using 3.2 so I had to get it clean up back to 3.0. I could have edited the Gemfile, but again I wanted a clean base setup. I trashed the project and rebuilt it with 3.0 scaffolding.

Forcing a push to Github

I added the remote github repo and tried to push but there were conflicts. I honestly  didn’t care at this point so I forced the push not typically advised but I was running out of patience:

$ git push -f origin master

sqlite3 instead of pg

All good so far now I could deploy

$ git push heroku master

but there were errors. DOH I forgot that they use postgress on Heroku not sqlite3. I wasn’t ready to install postgress locally so I opted for a split DB setup. Again this is not advised, I should be using the same DB locally and in prod. I just wanted to get this running though.

Time to update my Gemfile from

gem 'sqlite3'

To this:

group :development, :test do
 gem 'sqlite3-ruby', :require => 'sqlite3'
end
group :production do
 gem 'pg'
end

Once that’s saved I went back to a little tip about –without production and ran:

$ bundle install --without production

Then I continued with the deployment and ran

$ heroku run rake db:migrate

and everthing worked fine.

Now I can focus on writing the code and not worrying about the environment setup.


Creating a Vision – An Analogy

visionAnalogyI’m a big fan of vision and mission statements. Many people think they’re fluff but I truly believe they are valuable tools. I think vision and mission statements are misunderstood, and are really much more difficult to write than one might think. For example should a vision change yearly? When you communicate your vision are you really communicating a road map of activities?

Here are two analogies I thought of that calls out the difference between a roadmap and a vision.

imageScenario 1) As the leader of my family, i gather my children around and tell them. “Kids, we’ve got a good chunk of money put aside and we’re going to use it. Tomorrow we’re going to get up at the crack of dawn and get in the car. We’re going to spend 12 hours driving and then we’ll stop for the night. We’ve got 500 dollars allocated for this already. The next day we’ll get back in the car and drive another 12 hours. Here we’ll commit 3000 dollars over the next 5 days. after which we’ll get back in the car drive 12 hours stop for the night and drive another 12 hours the following day. Isn’t it great that Mommy and Daddy are spending this much money on you?”


How was that as a vision? Would my kids look forward to the literal and figurative Long road ahead?


Scenario 2) Untitled-2

I gather my kids around and say. “Kids we’re taking a road trip to Disney World”

Of these two options which would inspire and drive my kids. Which would help them understand what the overall goal is.

The point here is that, to me, a vision is a long term objective that inspires people and conveys the destination. Something that even if there is a detour in the road, serves as a guide post helping you get back on path to the right direction. It helps you get through the long boring drives, or stressful days at work. It brings people together in a collective goal and guides teams toward a shared future.

A vision is more than a road map or a play by play of what is coming up next. A vision is communication of where we are trying to go, not how we’re are getting there.


Reward the effort not just the outcome

I came across this again recently and was reminded how important the concept is. It’s easy to call out achievements and successes we see, and of course the bigger the success the more likely we praise. However, we need to also focus on praising the effort in addition to the outcome.

Kaizen is a successful philosophy of Continuous Improvement touted by many business leaders and publications. By recognizing the effort an not just the outcome, individuals are more motivated to improve all aspects of the organization, from rolling out multimillion dollar cash cows, to posting a sign reminding people to not put metal in the microwave.

Often good intentions go unnoticed simply because the outcome isn’t clear. For example when a developer refactors a method, the outcome is typically just that it’s easier for other developers to work with. There is no functional change and therefore its difficult to call out. However these small efforts that continually improve our business are just as important, if not more, and should be recognized just the same.

Praise is infinitely divisible, hand it out and you’ll always have more. You can say Good Job all day and never run out.

So take time this week to recognize the efforts within your teams not just the outcomes.


There’s no emotion in business

In the 1992 movie A league of their own, Tom Hanks (the coach) emphatically berates one of the female baseball players saying “There’s no crying in baseball!”.  I can almost hear him saying that about business too, “There’s no emotion in business!”.

I’ve always been fascinated at how the professional world is founded on vulcan like logic where there is little room for emotion. Early in my career I was very passionate about my profession and, being green, that translated to emotional driven conversations, and poorly chosen wording to the wrong people. Over time I’ve worked hard to maintain the passion but curtail the emotion. I’ve read communication books, reviewed my distribution list, paused before clicking “send” and have made decent strides over the years to remove the emotion from my professional communications.

Recently I’ve been reviewing another aspect of this concept. Personal communications with colleagues. Take this scenario, you and your buddies go out for a beer, you might mention how work is getting on your nerves and how bob from accounting keeps getting on your case for those TPS reports.  Now suppose there’s another guy at work that you go to lunch with now and then. You have the same conversation with him as well. That is proabbly not a good idea.

I’m of the mindset that these more personal conversations probably shouldn’t occur with any professional peers. You may have a decent working relationship with someone where you can be honest about the state of things but even in these situations professionals need to keep their guard up and act professionally.

Here’s a scenario. Jim and I are in different groups but working on a project together.  We’ve been on project for some time and have a rapport.  One day after dealing with marketing  I fire off an email to Jim. “Marketing really is annoying, why can’t they just give us a plan and stick to it instead of changing it every day”.  Jim agrees and we move on.

I let emotion slip into my communication though and while I have a decent rapport with Jim we’re not drinkin’ buddies, and even this minor level of emotional conversation sets a tone about me and my professional maturity.

It’s sounds simple and harmless but this level of personal communication will limit your career.  Rather than presenting the emotional statement of “Marketing really is annoying, why can’t they give us a plan and stick to it” I might be more professional and say “Marketing is impacting our ability to deliver the project. We need to meet and discuss locking down the plan to avoid these additional costs”

Business favors logic and discipline, and those of us with passion and emotions need to filter our words well in order to succeed.


Coffee Notes: Want Better Quality? Fire Your QA team

Ok maybe don’t go that far but this is a great read on holding developers accountable.

I love the last paragraph.

Work_Pic_normal.jpgJim Highsmith (@jimhighsmith)
2/21/11 4:00 PM
Want Better Quality? Fire Your QA Team. | Forrester Blogs http://bit.ly/fn3vij

Coffee Notes: features vs quality

Here’s an interesting article on the value of internal quality.

gravatar_normal.jpegDavid Bernstein (@agile_design)
2/21/11 3:08 PM
Software mgr? Read this!! @martinfowler: features vs code quality: http://martinfowler.com/bliki/TradableQualityHypothesis.html

Spike: Unit Testing Static Methods

Previously we began discussing how great it is to use mocks and stubs. We showed how you can use dependency injection to set a stubbed out service instead of the real one. We also reviewed how you can use mocks to verify methods were acted upon from withing the method under test.  However you may come along a scenario where you need to test a method that requires you to call a static method on some other object. Regular mocking won’t suffice. Now it’s time for PowerMock

PowerMock is a nice add on to Mockito (and others) that supercharges what you can do with your tests. Continue reading


Follow

Get every new post delivered to your Inbox.