Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 12/5/2008: RubyMine gets Focused; We're slow & lazy

Interesting Things

  • A polite reminder that when defining associations that need :class_name or :source keys that the values should be strings and not Ruby constants. That way lies madness.
  • RubyMine build 500 gets running “Focused” Test::Unit tests (file or single test) right via Ctrl-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

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.

  1. Pat Nakajima says:

    With regard to using strings for declaring association options, I like taking the following approach:

    has_many :foos, :class_name => Bar.to_s

    I’ve found that it specifies the intent to use the `Bar` class more clearly than just a plain string.

  2. grosser says:

    Bar.to_s seems like a good approach, at least it will explode when the class is missing…

    for the widget thingy, why not just create a checkbox for every bar
    foo[bars][] value=”13″(id) and then have a bars= / bars method on foo that reads and assigns the bars

  3. Josh Susser says:

    The point of using strings instead of actual classes is to avoid forcing loading of a class before you should. Doing SomeClass.to_s is just as bad as using the class itself, since it will force the load, and next thing you know you’re stuck in Arkham Asylum…

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *