Skinny controller, fat model and Facebook

As some wise man says it is good to have most logic in models not in controllers (I don’t even mention view as place for logic). Good said. But I think this is not always possible.

Lets take Facebook application in consideration. RFacebook gem (and Facebook authorization system in general) is based on HTTP session. So when You make any query to Facebook You need have access to fbsession object. As far as I know, there is no easy way to access to current HTTP session (on top which fbsession is built) from model level. As a result I don’t see possibility to build keep this schema (skinny controller, fat model) when You need retrieve any data from Facebook to make model work as needed.

In some cases You could store some data from retrieved from Facebook in own DB and then You could do operations with them without access to HTTP session. But storing most of data provided by FQL You need say in Yours application terms of service (this is how I understand Facebook’s storable attribute).

And is worth to duplicate Facebook database in order to keep up schema?

Approaching to release new FFM

We are almost ready to release new FFM version to production server. This release will incorporate some major changes from UI perspective.

We have decided to come back inside Facebook’s interface. This mean that FFM will by default no more escape from Facebook to standalone version. But if You like FFM as standalone – don’t worry, as I have mentioned two days ago, application will work perfectly as standalone – just type its address ( into browser.

FFM will notify You and Your friends You have uploaded new OPML (and possibility of new feeds) and will place in Your Facebook profile link with number of feeds in Your OPML. Well, we had plan to use our widget in Facebook profile (or create something similar), but as for now I think it is not possible.

Facebook does not allow to create profile entry which content will be dependable both on profile owner and viewer. Unfortunately it looks like fb:iframe is being not allowed on profile (as set with profile.setFBML). That would allow to move our widget inside Facebook.

FriendsFeedMe on new gem

I did finally upgrade and now our development version works with RFacebook gem in version 0.9.0. Last weekend I have spent on other tasks, so it took a few days longer.

There is side effect – FFM now works as in_canvas, in_frame and standalone application. How it can be made? First You need configure Your facebook application as in_canvas. Then You set callback_url for some controller (in our case it is CanvasController). This controller role is to render FBML with fb:iframe pointing to Your normal F8 application. Starting from now this application works as iframe version.

Now, if CanvasController will detect with RFacebook in_facebook_canvas? is not in canvas, then should redirect to iframe version directly (with HTTP 302), allowing to run application standalone.

So, when You click on sidebar-nav in Facebook, You will be taken to version embedded into Facebook layout. When You type application address directly in browser, You will get output free from Facebook layout.

At this moment this code is not released to production so I will notice You when You will could check how this looks.

New RFacebook gem/plugin

When I was on vacations RFacebook gem have been under very heavy development. I’m implementing it in FFM app, and right now I’m trying just to run application server :)) but there is to many errors.

When I finish I write down my experiences with migrating from RFacebook gem 0.6.x to 0.8.x series. 0.8.x looks like huge improvement, add developing application should be easier (like debugging output in pages).