Archive for the 'Ruby' Category

Mar 10 2008

Expected things_controller.rb to define ThingsController

Published by Bill under Ruby on Rails

Well, I had fun with this rather obscure error today. The basics are simple, for some reason, app/controllers/things_controller.rb could not be loaded or did not supply the expected class ThingsController. One common cause of this is that the helper for this controller is mistakenly named in singular form instead of plural. In the case of app/controllers/things_controller.rb, make sure app/helpers/things_helper.rb is not named thing_helper.rb and that the module it is supplying is named ThingsHelper and not ThingHelper. It is ok if the helper does not exist at all. This error is sometimes even more difficult to debug in the case of a misnamed helper because it can appear to be intermittent. The problem will only occur when a method defined in the helper is called due to lazy instantiation.

I hope this helps someone. As always, comments are welcome.

No responses yet

Feb 23 2008

Design Patterns in Ruby

Published by Bill under Books, Ruby

If you are a Ruby nut like I am or you are just beginning in the language, I highly recommend Russ Olsen’s Design Patterns in Ruby.  The book covers many of the original “Gang of Four” patterns from the classic book Design Patterns but it applies all of the Ruby magic that is inherent in the language.  For those new to Ruby, this is not really a starters book, but it does have a simple introduction to the language that would suffice for those with development experience in other languages, especially object oriented languages.  The examples in the book are well thought out and include enough detail to allow the reader to understand the pattern in full, without going too far which could obscure the point of the example.  Congratulation Russ, this is a fantastic book.

No responses yet