I’ve uploaded my MMValidation project to Github. It’s an easy way to get Rails-style validations on any subclass of NSObject.
You declare validations like this:
+(void)initialize {
[Person validatesPresenceOf:@"firstName"];
[Person validatesPresenceOf:@"lastName"];
}
And check them like this:
if ([myObject valid]) {
// yay! proceed as planned
} else {
// handle the validation errors
}
Click here to get it. Hope you enjoy!
If you’re Ruby metaprogramming and you need to call send several levels deep, give this little utility method I made a try:
class Object
def deep_send(s)
s.split(’.').inject(self) { |memo, obj| memo ? memo.send(obj) : nil }
end
end
Then you can say some_object.deep_send(’this.that.whatever’), instead of a bunch of inject/Proc messiness.
TextMate rules!… until you hit Command+Shift+F and try to do a ‘Find in Project’
It beach balls because it’s searching huge log files. You can fix this by going to Preferences -> Advanced -> Folder References and entering this value for ‘Folder Pattern:
‘!.*/(\.[^/]*|log|.svn|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$
I just added log and .svn to it (.svn may not be necessary, [...]
Patrick showed me a very cool site: gravatar.com. At this site, you can upload an image of yourself (or whatever) and tie it to an email address. Then, any time you post a comment on a Gravatar-enabled blog, your image will show up next to your comment.This would be a great feature to add to [...]
So, you just finished reading your copy of Agile Web Development with Rails, and you’re ready to launch an Internet startup.
You get everything set up: hosting, database, subversion…you put the finishing touches on your capistrano deployment recipe. Your app is now online, ready for the whole wide world to see.
You tell all your friends [...]
It’s been a wild first week for me after launching greenisus! I’ve spent most of my free time this week talking about it and coding new features. There are more on the way, but for now we’re going to work on a few small ones and make our Ruby on Rails test suite as comprehensive as [...]
The most important thing we can find is each other, so I wrote a Ruby on Rails plugin to do just that! This plugin will search Active Directory and give you a list of names in a script.aculo.us autocompleter. It works great for me, but your mileage may vary.
Before you install, you’ll need [...]