Set Restriction Info with Facebooker 1

Posted by jcnnghm Tue, 22 Sep 2009 11:03:00 GMT

I’ve been working on a Facebook App and I was trying find out exactly how to go about setting content restrictions with Facebooker. While the documentation for the Admin.setRestricitionInfo API call is pretty clear, the Facebooker documentation is less clear.  It looked to me at first glance that the Facebooker::Admin.set_restriction_info method would have to be called with every request.  This seemed terribly innefecient to me, so I tried some other methods out until I found something that worked. In config/initializers, I created a facebook_permissions.rb file, and inserted the following code:

Facebooker::Admin.new(Facebooker::Session.create).set_restriction_info(‘type’ => ‘alcohol’)

This code will run every time your server starts, updating your application restriction settings.  Run the following command from script/console to double-check that the restrictions are being set correctly:

Facebooker::Admin.new(Facebooker::Session.create).get_restriction_info(‘type’)