Davis W. Frank's blog
Our customers are asking for richer interfaces and user experiences. And so we - and by "we" I mean the Rails development community - are writing more and more JavaScript. We've gone from ignoring JS (using RJS server-side) to rendering JSON and writing our own jQuery plugins.
But in this transition some of us left our objects & design patterns on the server. Just because you're writing a click handler in JavaScript doesn't mean it couldn't, or shouldn't, be a method on an object.
Interesting Things
- Caveat Experior: Pivot Mike found a bug in Webrat in Selenium mode when using #click_link. He filed a ticket at Lighthouse.
- Caveat Coracinatus: Attention to those "Riding the Toad" (I didn't make this up - it's on Hoptoad's homepage): the Hoptoad Notifier gem that was released on Jan 20, v2.1.1, is missing a file. Make sure to update to the latest version, v2.1.2 in order for this gem to work. You should be on the latest gem anyway because there's a deprecation in the session code that will stop working in February. If you have a site that's not actively being developed you will need to update the gem & redeploy your app in order to continue to receive exception notifications.
First, thanks to everyone who came - especially those who laughed at all the right spots. If I didn't get to your question, I'm here through Thursday afternoon.
There were a couple of questions during the talk and lots after the talk about how to deal with remote pairs. Since it's RailsConf and most folks are on MacOS, ScreenSharing.app came up.
As I've mentioned before, I'll be giving a talk at RailsConf on how I "got more agile" once I was able to practice every day. The goal is for my story to help you in your career, telling some good stories in the process.
To celebrate/entice you to come to RailsConf & my talk, (Tuesday, 2:50pm, Ballroom A) and to thank those of you who contributed your own tips, I have two things for you.
First is a promise of Pivotal Labs swag (content TBD) to anyone who submitted a tip & to the first five comment authors who claim it below and identify themselves at the actual session - no sneaking off to Scott's Advanced Git talk.
Second, for everyone, is a RailsConf discount of 15% in case you haven't registered yet. When you register, use the promo code RC09FOS. Note that as of yesterday, the Hilton's room rate has dropped to $99 a night. w00t!
Warning: a bit of Shameless Self-Promotion follows
Sitting in more than one session at RailsConf 2008, I noticed speakers that were advocating, directly or indirectly, Agile practices. But, aside from Kent Beck's great keynote, there wasn't a lot of 'pure Agile' on the program.
I left the conference inspired to write a presentation that would help those in the Rails community get better at their jobs.
I had some ideas, but last summer I asked you what helped you be Agile day-to-day. I took your comments, the tips from fellow Pivots, and my own hacks and made them blend. The result is a presentation called "I Rock, I Suck, I Am" that was accepted for the program at RailsConf 2009.
So thanks to you for your thoughts & comments - they all helped shaped my presentation. And if you're at RailsConf, come on by with your curious and/or reluctant peers and have a listen.
Interesting Things
- A polite reminder that when defining associations that need
:class_nameor:sourcekeys that the values should be strings and not Ruby constants. That way lies madness. - RubyMine build 500 gets running “Focused”
Test::Unittests (file or single test) right viaCtrl-Shift-F10. Specs aren’t working quite right yet, but JetBrains appears to be working on it.
Ask for Help
“Anyone having odd slowness with Google Gears?”
We are having an issue with slowness in a Google Gears app, where certain actions take several times longer on some boxes. It is only slow on some of the client’s windows XP machines, but not all. Never on mac. It is slow in BOTH Firefox 3 and IE 7 on the slow machines.
The Gears sqlite db and dir does not seem to be the problem either - a clean IE data, cache and gears data dir still runs slow, and moving the ‘slow’ gears data dir to a fast machine runs fast.
Also cleared all IE data, compared/upgraded Gears versions, Java versions, and Windows Service Pack versions. Nothing seems to be a common denominator yet. Nothing obvious on google searches…
"Multi-select widget for a 'has_many :through' relationship?”
I have an association like this:
class Foo
has_many :bars, :through => :barrings
end
I'm looking for a 'widget' for the Foos page that will let me assign/unassign multiple Bars at once. Looking at the select, select_tag, options_for_select helpers, etc, reminded me that the Rails built-in stuff is lacking. I was hoping that someone has already written a sweet multi-select widget that I could be lazy and use.
Interesting Things
- There was an edge version of Rails (this project has a frozen Rails at some point in the past) that had a bug where a namespaced route would send a POST that should go to
MyController#createwas instead going to a POST toMyController#index. The fix is to freeze to current Edge, or usealias_method.
Ask for Help
"Any way to turn off a validation in a re-opened class?"
No way to do this. Best to refactor by pulling the validation out of the class and then mixing it in, or not, at a different level.
Interesting Things
- Y!Slow + Firebug + submit a form will cause the result to be pulled from cache instead of hitting your server. The workaround is to disable Y!Slow.
- Some of our customers are requesting targeting Firefox 3, which has some rendering differences from FF2. So we're adding FF3 to the system image with a new icon and the correct trick to let it run side-by-side with FF2.
- How to Run FF2 & FF3 side-by-side on Mac OS X
- FF3 customer icon that is sufficiently different than Firefox's normal icon so you can tell the difference
- On a related note, rumor is that Facebook is dropping support for IE6. So is 37Signals.
- Interesting issues with the Globalize plugin & Rails 2.1:
- The currency formatting code does not work at all anymore - it always uses a '$'
- Their work for localizing templates, which involves injecting a fully-qualified path, breaks
#assert_template. The workaround is to comment out the path injection code, but this only works if you don't have localized templates.
- EngineYard's eycap gem version 0.3.6 now has better support for deploying from SVN tags
- Deploying from tag, since the URL was different used to do a
rm -rf, which takes a long time on EY's GFS disks for large file sizes. This was causing a customer's deploy taking ~20 minutes - The fix was to change eycap to use svn switch; the deploy now takes ~1 minute
- Deploying from tag, since the URL was different used to do a
Ask for Help
"Anyone seen/solved an issue with random font size increase using Firebug 1.1 or later?"
The issue is that at some point a page will render with much larger fonts and the CSS exploration won't tell you why. The work around is to launch a browser with Firebug disabled and run it side by side with the same page in a window with Firebug enabled (restarting the 2nd window whenever the problem occurs.)
Seeing this with Firefox 2 and 3 and any Firebug later than 1.05 (which doesn't run on FF3). This might be an issue with IFRAMEs, but we're not sure. No data found on this via Google searches or the Firebug group. We will post there.
Interesting Things
Model#update_allis your friend if you're not yet on Rails 2.1Like
Model#update_attributefor each attribute,#update_allwill save direct to the database, bypassing validation, updating only the columns you specify. In Rails 2.1, with partial model updates, you may not need this. But if you've not yet upgraded your application, then give#update_alla try.
Update: fixed per comment. Model#update_attribute does not validate. Thanks for the catch!







