_Programming-specific content ahead. Skip if you’re not interested_
I recently upgraded to [Rails 0.12][rails] for it’s juicy ‘eager association’ goodness, and promptly discovered a bit of a bug when using the new Base#find with `:order` on the `belongs_to` end of a `has_many` association. Whew, that’s a mouthful. (And wow, [that was fast][bug], my bug’s already fixed)
[rails]: http://weblog.rubyonrails.com/archives/2005/04/18/rails-0120-eager-associations-new-basefind-api-assertions-revisited-more-ajax/#comments
[bug]: http://dev.rubyonrails.org/changeset/1220
I also had some issues with a lot of the Javascript on my current project not working. Specifically, I do a lot of work with `Display.toggle`, which is being deprecated. It’s a good idea to replace all instances of `Display.toggle` in your code with `Element.toggle`, the replacement method.
I’d also been finding the element by id before passing it to the function, as in:
Display.toggle($(’my-element’));
but you don’t need to do that any more. (Did we ever have to?) You accomplish the same result by calling:
Element.toggle(’my-element’);
That’s fine with me, since it’s a little less finger contortion to type that than typing all those $’s and apostrophes in rapid succession.
Oh, and while you’re at it, check out the new Element.show, Element.hide, and Element.remove methods!
`getElementsByClassName` has been moved to **document**`.getElementsByClassName`, and that tripped me up because a couple of methods I’d written to apply anonymous functions _en-masse_ to certain page elements used this. Once I’d taken a look at **prototype.js** for a few minutes I figured it out, though.
I hope this helps others using the Ajax library to debug after the upgrade. Prototype.js is full of goodness, but not all that well-documented yet, so I thought I’d toss in my 2?.
If anyone else has tips/tricks/warnings on the upgrade, please share!
Post a Comment