If you are using the acts_as_state_machine plugin to manage the state of your object keep this in mind: If you are going to have an object like an order or something similar that likely has a field state_id to relate in a geographic state then you need to be sure to rename the column that…
Shoulda Doesn’t like ‘Status’
One of the models in a project I am working on right now ends in ‘status’. Rails handles that just find but in my tests I started noticing an odd error: test: Lookup should belong_to lookup_status. (LookupTest): NameError: uninitialized constant LookupStatu </pre> The Shoulda test looks like this: should_belong_to :lookup_status </pre> Nothing to complicated there….
Tip for Testing Email with Ruby on Rails and Shoulda
Shoulda comes with a great method for testing email called ‘assert_sent_email’. (If you try it and get a method missing error update Shoulda. Not that anyone wouldn’t know to just do that). No matter what you use to test email as long as you are in test mode your emails will be placed into an…
Shoulda, assert_sent_email and Unreal Users
I have been banging my head against a problem in my testing. Using the UI everything worked as expected, but my tests were failing when I tried to see if emails were being sent in a specific case. Here’s the test I was trying to run using Shoulda: context “reset password for user that has…
Secrets and Inspirations
I have an embarrassing secret. I love cycling (not the embarassing secret unless you count running around in skin tight shorts as embarassing). No, the big secret is that when I am all alone on the bike I can’t help but feel the desire to chase down every other cyclist on the road. I will…
iPhone Apps, meh..
I was pretty excited to see the new app store show up on iTunes. As a faithful fan of everything Apple I was looking forward to this big event. Now? Meh, I could take it or leave it. I just spent half an hour browsing through the applications. I downloaded some because they are there,…
ActiveSalesforce and Ruby on Rails > 2.1
We have to do an integration with Saleforce for a Rails project we are working on. I keep getting this error: The :dependent option expects either :destroy or :delete (:nullify) I posted to the Salesforce forums and didn’t get any response so I did some more investigation. Turns out there is a bug and a…
Checkbox list in Ruby on Rails using HABTM
Checkboxes are one of those things that look easy and should be easy, but they aren’t always easy. I needed a solution that could create a checkbox list of languages that a user speaks. So I don’t forget here’s how to do it: The migrations are important. You have to be sure to exclude the…
Snakes in the Grass
Last week right before we left for Yellowstone I went out to work on the sprinklers for the garden. I threw on some flip flops because that was easy. While walking around I felt something go over my foot. I thought it was the grass brushing against me ( I don’t like to mow the…
Scalr – Scalable Hosting Framework for Amazon Web Services
Amazon’s web services business has sparked a number of business opportunities. Using EC2 and S3 is not especially easy for a beginner, but scalable web architectures aren’t a place for the weak hearted geek. Enter Scalr. This is an open source project meant to make building a scalable, fault tolerant system on Amazon’s services easier….