[Facebooker-talk] Overriding id with facebook_id???
lee at crossbonesystems.com
Tue Nov 11 13:08:03 EST 2008
2008/11/11 Joseph Durden <josephdurden at gmail.com>:
> I am new to rails, and was wondering if there would be unknown consequences
> for setting the user tables primary key to being the facebook_id of a user.
> I have implemented this funcionality, and everything is working fine. All
> associations etc. What are the risks if there are any of overridding the id
> with facebook_id? Why would I not want to do this?
I'm doing this at the moment. The biggest thing I was concerned about
was the potential for facebook user IDs to be 64bit numbers. (I can't
remember the official Facebook stance on ID size but I'm pretty sure
they weren't ruling out 64bit IDs). Rails migrations don't seem to
support 64bit values (on mysql at least) out-of-the-box.
I worked around the issue by patching ActiveRecord. I added a snippet
(attached) to environment.rb based on the following post and all seems
fine to date:
Use column type :int64_pk for your users table and :int64 for any
foreign key columns.
Director, Crossbone Systems Ltd.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1097 bytes
Desc: not available
More information about the Facebooker-talk