Interesting Things
- There's a new release of Desert which includes a method
Desert::Manager.require_all_filesadded by Brian Takita which does eager loading.
Help
"Overriding attributes in form helpers seem to be skipped, and the attributes in the database are used instead. Is there a reason this behavior makes sense?"
Adam will be submitting a patch that allows overriding of attributes. It as mentioned that the existing behavior might be useful in the error case of a pre-coerced form.
Interesting Things
- v802 of RubyMine does not auto save when focus is lost. A bug report has been submitted. Along those same lines, RubyMine is nearing a public release, now is your chance to vote up any features you want to see. Cucumber support was explicitly mentioned.
- Rails has been selected for Google's Summer of Code. While we may not be students, there are opportunities to be a mentor.
- Be wary of an ad provider: Some ads will redirect your users to unwanted destinations. Placing the ad inside an iframe will let the ad do what it wants to do, without hurting your user's experience.
AutoTagger is a gem that helps you automatically create a date-stamped tag for each stage of your deployment, and deploy from the last tag from the previous environment.
Let's say you have the following workflow:
- Run all test on a Continuous Integration (CI) server
- Deploy to a staging server
- Deploy to a production server
You can use the autotag command to tag releases on your CI box, then use the capistrano tasks to auto-tag each release.
Interesting Things
- IE doesn't allow you to change the type of an input. If you create an input with createElement, IE will not allow you to change that element to a button. This was discovered when a project's javascript dom builder code was modified to generate inputs of type=button rather than type=submit. The cross-browser solution was to create some other temporary dom element such as a div and then set the innerHtml of that element to a type=button input, then extract that child element and return it in the builder call. Yeah!
Ask for Help
"What's the best way to get gems for forked repos?"
There was quite a discussion on this. The specific issue is that the team is trying to use Compass (Chris Eppstein gave a talk on Compass at Pivotal on 3/18-look for the future video on our Talks Page.) For the moment, since compass depends on the edge version of sass you must first manually install sass before installing the compass gem.
- One suggestion was to submit a fix for the gem. This is not a good solution in this case since the new version of sass/haml is expected to be released soon, fixing compass and simplifying its installation.
- Pivotal will likely host its own internal gem server at some point to deal with issues like this.
- The Has My Gem Built Yet? service might be useful in some situations, but not for this specific problem.
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!
Ask for Help
"How do you test request headers? The request object is frozen..."
The team is using rspec to test an OAuth implementation and needs better access to the request object.
- Possibly modify the request environment prior to running the test -or-
- Instantiate a new, non-frozen request object.
At Pivotal Labs we take Continuous Integration (CI) seriously. Every project has a dedicated machine that serves as a CI environment. Each checkin on the project causes a build to be kicked off. A "build" means checking out the code from scratch and running of all the project's tests, which, for a Rails project, means unit and functional tests, JavaScript tests and Selenium tests. For the JavaScript and Selenium tests, we run multiple browsers on multiple OS's (e.g. IE 7 on Windows XP, FF 3 on OS X, etc).
We consider it critically important to keep each project's build green (i.e. successful) at all times. A build is the heartbeat of the project: if it's green, everything is healthy; if it turns red (i.e. fails), the team is encouraged to jump on the problem and get it back to green right away. We want red builds to go away quickly; the longer a build stays red, the longer it takes to track down the problem and the more likely it is that additional tests will be broken (the "broken windows effect").
In order to facilitate this level of discipline, we've learned over the years that making the status of our CI environments obvious and visible to the team is critical. If a team isn't acutely aware of the status of its build, it's unlikely that a red build will get noticed and fixed quickly. You can have the CI server email the team, but that doesn't work very well when the whole team is pairing all day: it might be a few hours before someone notices the email. You can install plugins in your browser or system tray that show build status, which helps, but still, they're not always obvious enough. The best way we've found to keep the team informed is to display the status of the build high on a wall near the team as a big red or green indicator. That way, even when you're busy coding, it's easy to notice the build going red. These days we use 2 wide screen TVs, positioned in the office so that one is easily seen from any developer station.
Pivot Corey gave a brown-bag lunch talk titled "There is No Such Thing as a CSS Class" (slides and notes) where he describes establishing a project specific "CSS System." This excellent presentation complements the "Consistent and Effective CSS" talk (video and live demo available) given by Pivots Corey, Ryan, and Chris.
Interesting Things
- Branches + JsUnit + CI + IE = :-( : Apparently it is difficult to manage IE's cache in CI. One project apparently has a bat file on CI that clears the cache every 30 minutes. Another team solved this by making the cache directory read only. Often browser/OS combinations have some technique for disabling caching.
- Test Swarm Alpha: this is a crowd sourced javascript testing solution (think seti@home for javascript testing) being developed by John Resig.
Ask for Help
"AR attribute appears to be skipped by text field helper?!" Apparently the model method is bypassed by the text field helper if a column of the same name is present in the underlying table. This was experienced in Rails 2.2.
Others have apparently experienced this in the past but a clear answer did not surface.
Interesting Things
- Browser History with Javascript and Page Based Json: One of our projects solved the vexing problem of browser history for a page that has initial page provided json with subsequent ajax updates. A simple page back operation will display the originally downloaded data, not the updated data. The solution is to add a unique id for each page, and store these ids in a cookie. When an ajax request updates the page it removes its page id from the cookie. When you use the back button, each page checks to see if its unique id is in the cookie, and if it is not, it forces a reload.
Really Simple History was mentioned as another way to manage javascript/ajax history. - Rubymine Build 784 has the Weirdest. Bug. Ever.: This may only be a problem if you work on a mac and you need to enter capital letters in rubymine dialogs like find and replace ;-). Many of us are fans of intellij/rubymine, but we wish they had a better test process. To be fair, rubymine is in public preview, so expect the occasional bug or two.
