- We’re looking for the best search plugins for Trac. Suggestions?
- Rails: We often find ourselves adding
and returnin our Controllers to avoid the dreaded
DoubleRenderError. It turns out that you can use
<code> def double_rendering_action render :template => "wrangler/monkey" if wrangle_monkey? render :template => "wrangler/sleep" unless performed? end </code>
Some projects are playing with the Mocha mocking framework. From their site:
Mocha is a library for mocking and stubbing using a syntax like that of JMock, and SchMock. Most commonly Mocha is used in conjunction with Test::Unit, but it can be used in other contexts.
Our own Nathan Sobo has released Treetop 0.1.0:
Treetop is a Ruby-based DSL for text parsing and interpretation. It facilitates an extension of the object-oriented paradigm called syntax-oriented programming.
- Jeff from Inveneo presented us with a tech-talk recently about the technology they are bringing to rural and remote communities throughout the world. Fascinating stuff. A group here has volunteered to help write some software if needed.
Ask for Help
- “Are there problems getting Rspec mocks to ‘reset’ for each spec run?” Mocks persist across test/spec runs for class methods, so watch out.
- “My routes arn’t working…” Remember that Rails routes are positional, which means that they are matched top-to-bottom; changing the position seemed to be the fix in this case.
- We are hosting a Geek Session tonight at SF Beta. Tickets are going fast.
- Rails gotcha: with ActiveRecord.findXXX, you can specify query parameters such as
:include. But if you use those three together Rails will generate an incorrect query.
- Rspec 1.0 has been released.
Ask for Help
- Yahoo’s Geolocation service is broken after they released a new version if their code. Zip code searching in particular significantly broken — discussion thread here: http://tech.groups.yahoo.com/group/yws-maps/message/5468 — here is an example:
- Search for a zip code using the following URL: http://local.yahooapis.com/MapsService/V1/geocode?appid=YahooDemo&location=94102
- Result (notice the bad State and Zip tags):
<code> <?xml version="1.0"?> <ResultSet xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:maps" xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd"> <Result precision="zip"> <Latitude>37.779411 <Longitude>-122.417740 <Address> <City>San Francisco, CA 94102 <State>United States <Zip> <Country>US </Result> </ResultSet> <!-- ws05.search.re2.yahoo.com compressed/chunked Thu May 17 15:02:00 PDT 2007 --> </code>
This is fixed! Thanks, Yahoo!
- We’ve set up a Pivotal Rubyforge Project! Keep an eye out for code from us.
Ask for Help
- “Does anyone have recommendations for browser-embedded WSIWIG text editors?” The #1 recommendation is TinyMCE, followed by FKEditor
- “Rails cached-pages sweepers are causing a
nil.controller_name_error deep in the rails framework…” We ‘fixed’ this with a variation of this patch: http://dev.rubyonrails.org/ticket/6199
- Several folks here are looking at Merb (Mongrel with ERB) as a light-weight alternative to Rails for certain targeted usages. We’ll be sure and attend the Merb hack-fest at Rails Conf.
- Debian MySQL pain: if your MySQL Client and Server versions do not match, MySQL behave badly, reporting that it cannot find UTF-8 support.
Ask for Help
- “Can you terminate an AJAX request?” The answer is “kinda”. XMLHttpRequest has an
abort()method will terminates the request in the browser and prevents any callbacks from being invoked. But, your server might still be chugging away on the requested action.
- Hpricot versions 0.4 and 0.5.x are causing us Segmentation faults. Why, Why?
- Rails gotcha: Rails’ automatically generated finder methods will not work properly if you have a class name with the word ‘And’ in it. For example, a RentalCarCompany might have many CarsAndTruck. You will have problems if you try to call
_and_is reserved for methods such as find_by_name_and_address.
If you are missing the Rspec gem, you specs will fail silently. It’s a good way waste a few hours trying to figure out what’s wrong.
- We’ve found another appable_plugins bug: it seems to prevent Rails View Helpers from being properly mixed-in to ActionMailer templates. We’ll send them our patch.
Total Stand-up Meeting Time: 10:00 minutes
- Profilers: If you want a good Ruby profiler, check out the ruby-prof gem. It even creates HTML call graphs.
- Gotcha: Rake and Capistrano tasks are global, regardless of their namespace. In addition, if a Rake and Capistrano task have the same name, they will collide: which one wins, nobody knows! We’ve had success encapsulating Rake and Cap tasks in Ruby classes and delegating to them as soon as possible.
- Though we’ve a big fan of Fast-JSON, the new JSON library is faster and appears to fix several of the bugs that FJSON was created to fix.
- Hackety Hack is a little tool to help beginners learn to program in Ruby, especially kids. Why is it cool? Because of Why! Why? Yes, Why!
Ask for Help
- “We have some really slow tests that test external dependencies, such as Amazon’s S3 Service… should we create a ‘slow suite’?” We are planning on doing this, and many of us have create ‘slow suites’ that run only in continuous integration… with mixed success. Sometimes people just ignore the slow suite’s errors.