MustModify Blog: All Posts for

1.day Ruby's case operator === behaved badly

May 29, 2009
This is a follow-up to a previous post about the Ruby case operator, ===. I previously understood that, for a === b where a is a class, the result would be b.class.ancestors.include?(a) when a is an instance, the result would be a == b This proves true for many examples. ---ruby >> 3.class.ancestors.all? {|a| a === 3} =>...


Organizing Search Results with Multiple Criteria using SQL

May 23, 2009
I love ruby; but for hard-core data manipulation, there's no place like the database. (I'm a poet.) Here's an clever way to sort results based on multiple criteria. Credit for this trick goes to "Erika Valentine":http://www.linkedin.com/pub/erika-valentine/13/49b/933 , who knows roughly everything about T-SQL.  Story:  As a consumer, I...


Elegant Code

May 14, 2009
Borrowing from Einstein... "Code should be as elegant as is readable, but not more elegant."


A video every Ruby developer should watch. ( and all other devs, but they would be sad.)

May 11, 2009
Every developer should watch "What killed SmallTalk could it kill Ruby, too.":http://railsconf.blip.tv/file/2089545/ from RailsConf. This is a whirlwind tour through the history of software development from Small Talk to C++ to Ruby. It is both ammusing and informative. He also talks about two of my favorite subjects, "Test Driven...


Good Times with Ruby

May 05, 2009
You know you work with a good language when one of your biggest challenges of the day is to find the right word to model a relationship.


received unexpected message :split [ an error in an rspec controller test ]

April 23, 2009
original code: --- ruby it 'should add a flight given the correct data' do details = Factory.build(:flight).attributes @mock_flight.should_receive(:save).and_return(true)   Flight.should_receive(:new).with(details).and_return(@mock_flight) post 'create', :flight => details response.should redirect_to( @mock_flight...


[Rails error] Unpacked Gem has no specification file.

April 20, 2009
Recently I started working on a new project. Every time I did anything from the command line, I got this irritating error message when rails loaded it's environment:  config.gem: Unpacked gem in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this. I run rake gems:refresh_specs. I get: config.gem: Unpacked...


"With all the Rights and Responsibilities ..." (a quotation)

April 16, 2009
"I've given you admin privileges ... this way you can see everything. Please do not make any changes to the data." - Shawn