Tutorial on developing a Facebook platform application with Ruby On Rails

June 29th, 2007

If you havn’t heard of Facebook. Where you been, living in a cave! Well you also probably know that in June 2007 Facebook opened a development platform for integrating new applications into Facebook, also codenamed F8. By the 24th June there were a 1,000 new applications available for the Facebook networkers to play with. According to both the online and traditional news media, Facebook have changed the game.

Well ZDNet are reporting that 1,000 developers a day are joining Facebook platform. That as it may, they are not all creating applications right away. The documentation is patchy, spread-out, difficult to understand and incomplete. It is a wonder so many applications are built because there is pain to go through to get there.

But this article is a complete tutorial for building a simple Facebook application in Ruby On Rails and should allow you to hit the ground running. We are going to create a recipes sharing application for Facebook from scratch.

UPDATE: The second part can be found here

UPDATE: This article is a bit out of date now, I have now posted an article on Rails, resful_authentication and Facebook connect

Read the rest of this entry

Broadening the Enterprise 2.0 remit with mashups

June 24th, 2007

InfoQ has a great presentation Mash-ups Meet the Enterprise by Rodney Smith at IBM discussing the application of web2.0 technologies within the corporate firewall. This is nothing new and has been an explosive topic since my post in February 2006 Enterprise 2.0

What is interesting are the areas beyond the typical talk of Enterprise blogs and Wikis and taking about the “personal mash-up” which relates to my first and second points of Enterprise 2.0

  1. Delivering all off the company information as addressable discoverable sources.
  2. Allow custom mash-ups of this information on a user-by-user basis

It’s the second point which Rodney Smtih is talking about. The ability for all users in the Enterprise to create their own mash-ups of corporate and web data and deliver the information they need independent of a companies IT departments. A so called “do-it-yourself” IT or Enterprise Mash-up.

Rodney Smith also talks about making your corporate information “mashable” which relates to my first point of addressable discoverable sources.

I think software like this is appearing on the larger web and will move swiftly into the Enterprise. Sites such as Yahoo pipes and Ning.

The problem with these kinds of user created applications is the likely backlash from corporate IT departments who are used to gate-keeping this kind of development. Instead IT needs to focus on the problems which need to be solved to create this kind of environment. This would include middleware and identity services.

So does this fall-in Andrew McAfee’s definition of Enterprise 2.0?

“Enterprise 2.0 is the use of emergent social software platforms within companies, or between companies and their partners or customers.”

The answer. Absolutely. Social software platforms is not limited to blogs, wiki’s and friends networks but a few more ranging remit. I like McAfee’s definition, it doesn’t try to be all inclusive but does focus the term more clearly than the scatter-gun that is web 2.0. The personal mashup will be the use of a social software platform.

Using Attached Files in Mephisto

June 14th, 2007

The Mephisto blog engine has added the facility to attach files to an article rather than just embedding in the article content itself.

I’ve now added some code which will show an attached image at the start on an article. You can do this by editing the home.liquid template to something like this:


{% if article.assets.size != 0 %}
  {% for asset in article.assets %}
    {% if asset.is_image %}
      <p class="image"><img src="{{ asset.path }}"/></p>
    {% endif %}
  {% endfor %}
{% endif %}

Contribution Manager. A Rails charity application

June 13th, 2007

A UK internet consultant I know, Allen Brown, has just released his first Ruby On Rails Application. Contribution Manager allows UK charities to track contributions and assists in making claims.

I had a chat to Allen about releasing his first Rails application:

Tell me a little about contribution manager?

It’s intended to help small charities collect the money they are entitled to claim back from the government. Estimates of the amount that went unclaimed last year range between £700M and £800M and I suspect the usual reason is that is just looks too complex. Contribution Manager makes it quite straightforward, generating the claim form for you and keeping track of all the details necessary to keep the tax man happy.

What made you want to develop contribution manager?

My business partner (also happens to be my wife) was doing the Gift Aid admin for a large church in London and convinced me to replace her old single-user Access database with a shiny new Ajax-enabled SQL-powered website. I made it very flexible – as Rails encourages such practices – and I soon realised that the solution would work for any small charity.

Which hosting solution did you plug for?

I was relatively early to Rails and quickly threw in my lot with those nice people at Textdrive. They are now Joyent.

Did they do a good job?

They are Rails experts but the support isn’t always as responsive as I’d like. However, the site was very reliable and quick once I mastered Lighttpd.

Who built it for you? How was you/their experience of using it?

I built it myself. It was my first Rails project. Rails is a fantastic framework and there’s no doubt that you can easily save yourself a couple of days by doing something automagically with a few lines of code. The problem I find is that the documentation is still in its infancy and you can lose those two days again trying to track down something that isn’t happening automagically when you want it to – or is when you don’t.

How much money did contribution manager take to set up?

Joyent bills me $15 a month and the domain costs me $9 a year. Oh yes, and the image of a piggy bank cost $1 from Fotolia. The rest was just manpower. My manpower to be specific. I did pay out quite a lot for a bespoke web design that I later largely abandoned but I’ve learnt from that experience and would buy myself a $50 template next time and modify it as I needed.

So there you go, I think Allen’s story says you don’t need to be a rockstar rails programmer or need plenty of cash to release your application

Liverail to RailsMachine

June 13th, 2007

I’ve just completed a switch over of hosting on liverail.net from TextDrive to RailsMachine and I must say I could not be happier with the experience.

The TextDrive hosting I was using was a shared installation and mephisto is not happy on shared hosting. Instead the virtualised Linux hosting provided by Railsmachine is truly excellent. All my previous problems with Mephisto such as out of memory errors, asset problems, comment problems and submitting large posts has gone. It is also considerably faster.

The capistrano deployment recipes on RailsMachine made it supremely easy to deploy a Rails application.

Right result all round. I can now get round to actually blogging rather than fighting to keep it running.

I havn’t as yet migrated the svn repository so you may be unable to download the RailsDAV or mephisto webdav plugins.

UPDATE: Anonymous SVN access is back. For anyone interested to setup read access for anonymous SVN at railsmachine I followed the instructions at How do I install mod_dav_svn? but changed the line in the domain config /etc/httpd/conf/apps/.conf from

Require valid-user
to
  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </LimitExcept>