Interesting Things
- The Rspec version 8.2 does not work well with appable_plugins: When running Controller Specs from within an appable_plugin, those plugin's test fixtures will not load.
- We've created some Rake tasks to run all appable_plugin tests in one go. Nice!
- We've moved to a bigger, faster SVN server, so checkouts and updates should be faster.
- Following up on earlier events, we've successfully completed migrating one client's codebase out of our SVN server and into their repository. Good job folks!
- Remember to use filter_parameter_logging in Rails, which prevents Rails from outputting the parameters you specify to any log files.
- Bidirectional polymorphic join tables and has_many_polymorphs: always best described as art!

Ask for Help
- Does anyone know how to exclude the 'log' directory from searches in the new IntelliJ IDEA Ruby Plugin?. The Java plugin allows for this.
- UPDATE: Here's how: in your project.iml file, add
excludeFoldertags inside your content tag.
- UPDATE: Here's how: in your project.iml file, add
<code>
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/components" />
<excludeFolder url="file://$MODULE_DIR$/log" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
</code>
Total Stand-up Meeting Time: 17:00 minutes
Interesting Things
- Rake tasks in Rails eat many errors, causing just about any error (including syntax errors) to to fail "silently": instead of displaying the real error, Rake will tell you that your task is missing. Not nice.
Total Stand-up Meeting Time: 9:00 minutes
Interesting Things
- rals_spec_server is a Rspec test running server that does not incur the test-framework startup time tax once it is running in memory. Preliminary (unscientific) results show that individual 'specs run 20-30% faster. But, you have to set
config.cache_classes = falseintest.rbfor the server to reload everything and pick up any changes you've made.
Ask for Help
- Now that we are nearly finished successfully transitioning control of a client's project to their developers, we want to use SVK to export a client's code our of our SVN repository into their repo. We've never used SVK, so experience reports would be welcomed.
Total Stand-up Meeting Time: 13:00 minutes
We're experimenting with running our Capistrano deploy onto a Mac Mini. Note that this is Capistrano running Net::SSH running ssh protocol and spawing a remote shell in which we execute commands. Unfortunately, the remote process can't find the svn binary. Even though running echo $SHELL returns /bin/bash, it's not executing any of the startup scripts we know about (~/.bashrc, ~/.bash_profile, /etc/environment, /etc/profile, etc.), and the PATH is remaining the boring standard one (/usr/bin:/bin:/usr/sbin:/sbin). Damon says there's a setting inside the sshd config that might help...
UPDATE: this was solved by setting
PermitUserEnvironment yes
in /etc/sshd_config, and then setting
PATH=/bin:/sbin:/user/sbin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/user/local/mysql-standard-5.0.24-osx10.4-i686/bin
in ~/.ssh/environment
Apparently the Rails rules for pluralizing controller names has changed. Recently the tendency seems to be to use plural names for RESTful controllers (e.g. GET /projects/42) rather than singular names for traditional controllers (/project/show/42). Is this intentional? Is it a new convention, or a change to the old one, or a violation?
We're having a Brown Bag today on Ruby Foo, covering many strange and wonderful topics, including class methods, singleton classes, lexical scoping, and the lambda calculus. And why the sea is boiling hot, and whether pigs have wings.
Words of wisdom: when you're modeling currency, don't use floats. This is a bad idea in the long run since floats might store $2.50 as 2.50000001. See Coda Hale's dollars_and_cents plugin. Ian adds: "Database tables for currency should be of type decimal. (e.g. amount DECIMAL(10,2)) This turns into a BigDecimal in your AR object, which is a bit of a pain, since it doesn't act exactly like a regular number. We talked about mixing in some methods into BigDecimal, to make it behave more like a regular numeric type. It feels weird coming from a Java background, and normal coming from a Smalltalk background. I'm curious what people's thoughts are on it."
Today is the Group Hug for our latest release of Tracker. Get ready to try to kill Tracker with love!
We like RSpec, and are ready to upgrade to the new version. There's a new style for the DSL; the old and new dialects will live side-by-side for a while but we should convert to use the new one soon.
Daylight Saving Time is coming up, and already it's causing some of our tests to fail: we had code that calculated the number of days between two dates. Turns out the implementation assumed that every day has 24 hours in it. Not so! March 11, for instance, will have 23 hours, and November 4 will have 25. That's in the US; see here for other countries.
Interesting Things
- JSON: the consensus seems to be that ActiveRecord's
to_jsonmethod is buggy, and that people wishing to transform their ActiveRecords into JSON should use the Fast JSON gem. - Here's a Rails gotcha: if you are performing a form
POSTfrom a Rails template, there is a risk that any query-parameters in your URL will "stomp" parameters with the same key in your form. In the following code example, id = 1 will be sent to your app:
<code>
# id = 1 will be sent to the app below
url: http://railsapp.com/person/play_with&id=1
--- in play_with.rhtml:
# id = 9 will NOT be sent to the app
# because of the `&id=1` in the URL
form_for :person, @person,
:url => {:action => :something, :id => 99} do |form|
# blah blah blah...
end
</code>
Total Stand-up Meeting Time: 13:00 minutes
Interesting Things
- The has_many_polymorphs plugin is finicky: order of operations is important! If you have problems with your associations after installing HMP, play around with the order of your
has_manyassociations and such. - Also, "type is not type": has_many_polymorphs' use of the
typecolumn is not the same usage of Single Table Inheritance's (STI) usage oftype. If you are using HMP for an ActiveRecord using STI (say, "Student" which extends "Person"), HMP needs to reference the base class/table, not the subclass (i.e. reference Person, not Student.) - If your Rspec test seem to be having problems finding the Models, Controllers, etc. that are the test subjects, make sure the directory 'spec test structure is correct: "model" for model tests, "controller" for controller tests, etc. Rspec assumes that these test directories exist.
- Finally, as if you didn't need to be told so, ActiveRecord will have problems if you create a table with only an
idcolumn.
Total Stand-up Meeting Time: 18:00 minutes
It's Monday, and a blizzard in the Lake Tahoe area has stranded several of our developer. No interesting things for standup today.
Interesting Things
- After the appable_plugins folks applied some of our patches, we upgrade. Thanks guys!
- Beer suggestions welcome for the retrospective tomorrow!
- One of our guys presented at the East Bay Ruby Meetup. Subject: Pivotal Labs' Capistrano extensions. Of note: when he asked the group of 45 Ruby enthusiasts who among them knew much about Agile Software Development and continuous integration, only 4-5 people raised their hands. Disappointing.
- We might present at the O'Reilly Web 2.0 Expo in San Francisco this April (topic TBD). We'll post the details here if it works out.
Ask for Help
- Is something goofy happening with Rail 1.2 REGEX pattern matching? One group is having problems after the upgrade.
UPDATE: Not really. It was a case where Rails 1.2 caught the bug that Rails 1.1 did not.
Total Stand-up Meeting Time: 10:00 minutes
Interesting Things
- If you are using named parameters, watch out! A routes-named-parameters bug bit us. It's fixed in Edge Rails but not in a released version of Rails.
- ... And as a public service announcement, Rails' routing was rewritten for version 1.2. If you are experiencing weird routing behavior, check the bug list.
- False alarm! The REGEX bug we mentioned the the last standup meeting... our fault.
- Let's say you have the desperate need to generate a drop-shadow for an image, or any other sort of shadow (haven't we all?). Check out Rmagick's Image::shadow() method, which can do it for you. Very cool stuff!
- More
svn:externalsproblems. I won't get into the gory details, but if are changing or removing asvn:externalsproperty on a directory, your best bet is to delete that portion of the directory tree and get a fresh version from SVN. You'll avoid most problems. - One project is using the Rails Simple Captcha plugin with success, and even has a successful Selenium testing strategy.
- Watch out for this appable_plugins bug ActiveRecord models in your plugin do not reload when your environment sets
config.cache_classes = true. End result: you might get "method missing" errors in your application for methods that the plugin's model declares. Ouch. Details available upon request.
Ask for Help
- Doh! Somehow we broke
ruby script/generate migration MyMigration. I suppose we should fix that.
Total Stand-up Meeting Time: 20:00 minutes
