Why are you using such an insecure and old browser? Please be aware that this site will not display properly in Internet Explorer 6. You can either upgrade to Internet Explorer 7 or use a proper browser such as Safari, Firefox or Opera.

Recently on Twitter


The universal paperclip


Posted by Jonathan Conway on 2008-04-11  Comments

Working in a dual Ruby web stack framework has it’s perks. Today I wanted to use Paperclip in my Merb app as well as my Rails app. So ten minutes later I packaged up Paperclip as a gem and tweaked it ever so slightly to work on both Rails and Merb. The hardest thing was getting the manifest right.

It just goes to prove how well designed and extracted plugins like Thinking Sphinx and Paperclip are in order to allow me to do this so quickly.

Gem can be found here if you’re interested. Any bugs let me know.

Thinking Sphinx for Merb... And Rails


Posted by Jonathan Conway on 2008-04-09  Comments

Update 2008-04-17
Pat’s integrated my changes and also removed the horrible double Rake task hack I did. Now the Rake task works automatically. I’ve removed my branch and now I mirror Pat’s master branch. Please use Pat’s branch instead as his one will always be the most up to date.

It started off this morning before breakfast when I wanted to get Pat’s excellent Thinking Sphinx plugin going in Merb. The next thing I know, it was all done with enough time to spare for some tea. However my first attempt I made was too tightly coupled with Merb when it didn’t need to be. So tonight I cleaned it up and now it’s flexible enough to be used on both Merb and Rails apps.

My experiment can be found here but I warn you to tread with care as it’s still work in progress. However it works quite well for me as we use both Rails and Merb at work. The gem is based on Thinking Sphinx trunk so please read that first if you have any problems.

To get going:


git clone git://github.com/jaikoo/thinking-sphinx.git

cd thinking-sphinx

rake package

sudo gem install pkg/thinking-sphinx.0.8.0.gem


In your Merb app add the following:

init.rb:
dependency 'thinking_sphinx'

Rakefile
require 'thinking_sphinx/tasks/merb
For your Rails app:

Create an file called search.rb in your iniitializers dir and insert:
require 'thinking_sphinx'

Add a file called thinking_sphinx.rake in lib/tasks and add:
require 'thinking_sphinx/tasks/rails

Then do the usual Thinking Sphinx setup such as adding the index info to your models, rake thinking_sphinx:configure, rake ts:index etc…

Thanks again to Pat Allan for creating such a well designed and abstracted Sphinx plugin.

Future? I’m eyeing up adding DataMapper support which I’m quite excited about… Hopefully I’ll get sometime in the next few days to work on this.

Update Pat announced the release of his re-write of the Thinking Sphinx plugin. Check it out here !