[Facebooker-talk] Facebooker and existing website?

Christopher Bailey chris at cobaltedge.com
Thu Apr 10 12:09:39 EDT 2008


One thing you may want to consider is using a combined user model.  This way
you can associate your regular (non-Facebook) users and their Facebook
account.  What's cool about that, is that if they take some action on your
regular web site, you can say update their Facebook profile box for your
app.  This is what we do, as do many sites.
To do so, one approach at least is to add columns to your regular user model
to store their Facebook persistent session and id, etc.  The caveat is that
you then need to add conditional logic to differentiate things at times.
 You also need to deal with synchronizing/associating their regular user
with their Facebook user, but honestly this is pretty easy.  In the app I'm
working on, when they add the Facebook app, it tells the user they need to
associate with their regular site account (we require this), and it sends
them over to our site, they login, and in that process, we store off their
Facebook infinite session key, and then redirect back to Facebook.  Again,
this is straight forward to do.

With that setup, then you can just have a before filter on your Facebook
controller(s) that check that the person has installed the app, by doing the
equivalent of User.find_by_facebook_session_id (or whatever you called the
column) or similar, etc.

On Thu, Apr 10, 2008 at 6:40 AM, Prateek Dayal <prateek.dayal at gmail.com>
wrote:

> Hi
>
> I am trying to use facebooker with an existing website that already
> has a model named 'User'.
>
> I therefore created a model called BkUser for use with facebooker.
> Also I have different controllers for all facebook requests.
>
> I am using acts_as_authenticated for handling login etc for my website
> and everytime a user is logged into my facebook app and tries to also
> browse the website (not through  facebook), I see an error like
>
> undefined method `find_by_id' for Facebooker::User:Class
>
> Application Trace
>
> lib/authenticated_system.rb:11:in `current_user'
> lib/authenticated_system.rb:6:in `logged_in?'
> app/controllers/main_controller.rb:14:in `index'
>
> I am using sql session store for storing sessions. As I understand
> instead of User model, Facebooker::User model is being queried but I
> can't understand why.
>
> Regards
>
> --
> Prateek Dayal
>
> www.Muziboo.com
> get an audience
> _______________________________________________
> Facebooker-talk mailing list
> Facebooker-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/facebooker-talk
>



-- 
Christopher Bailey
Cobalt Edge LLC
http://cobaltedge.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/facebooker-talk/attachments/20080410/224a7a0e/attachment.html 


More information about the Facebooker-talk mailing list