We recently had some great posts on the forum from larryk. I was just replying to Larry, and, what with the cup of rather fine Darjeeling, and an indulgently large pile of mini gingerbread-man biscuits, I got into the swing of it until I thought - this is a blog post!
Quick background — Larry has a model with 60(!) fields, and he has a page with <editor> tags for all of them. He’s discovered an O(n^2) problem because each call to <edit> calls updatable_by? which has to check all 60 fields to see what has changed.
Not pretty.
This neat hack just popped into my head — something I’ve wanted for ages. But what is it for?
class Object
def _?()
self
end
end
class NilClass
def _?()
SafeNil.new
end
end
class SafeNil
def method_missing(*args, &b)
nil.send(*args, &b) rescue nil
end
end
Not too bad — only one day later than advertised :-) It’s time to
gem update hobo
or
svn up vendor/plugins/hobo
Not content to fix a few of the problems in 0.6, we’ve added some major new features in 0.6.1
There’s a major overhaul to the Ajax part update mechanism. It’s now more secure and can cope with parts that need access to local variables.
Hobo now supports multiple user models, so you could for example have a separate model for regular users and administrators. Each has its own login and signup pages.
As always, see the changelog for the nitty gritty.
Now that is going straight into Hobo’s core extensions. Thanks for sharing Jay!
Meaning I can finally get rid of all that omap, oselect nonsense (if you didn’t notice those methods, don’t even ask, it was a bad idea. If you did and you use them - stop!)
Hmmm. Maybe it’s time to make this stuff available in a separate gem. HoboSupport? It’s starting to bug me when I’m in a non-Hobo script and all this stuff is missing.
p.s. Hobo 0.6.1 coming today!
Find what you're looking for quickly by using our keyword search. Can't find it? Try our links below.