[Facebooker-talk] Overriding id with facebook_id???
Anthony C. Eufemio
aeon2012 at gmail.com
Tue Nov 11 13:39:07 EST 2008
You'll also need to handle the fact that ids in Rails are automatically
incremented so when a user uninstalls the app you won't be able to remove
their account (perhaps just mark it as 'disabled' in your application or
some similar approach) so when they decide to re-install the app all you
have to do is set it to 'enabled'
-AE
On Tue, Nov 11, 2008 at 10:19 AM, Tres Wong-Godfrey <
tres.wong-godfrey at saniq.com> wrote:
>
> As of Rails 2.1 64 bit ints are supported in MySQL migrations. Formerly you
> needed to use a plugin to get this working in MySQL.
>
> Rails 2.1.0 had some problems with the implementation, but in 2.1.1 I
> believe they have fixed the implementation to work the same as Postgres, so
> using :limit => 8 gets you bigint in mysql.
>
> So something like this, should work under Rails 2.1.1 with no patching or
> plugins necessary:
> t.integer :facebook_id, :limit => 8, :null=> false
>
>
>
>
> On Nov 11, 2008, at 10:08 AM, Lee Mallabone wrote:
>
> 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:
>> http://snippets.dzone.com/posts/show/4422
>>
>> Use column type :int64_pk for your users table and :int64 for any
>> foreign key columns.
>>
>> Lee.
>>
>>
>>
>> --
>> Lee Mallabone.
>> Director, Crossbone Systems Ltd.
>>
>> http://www.crossbonesystems.com/
>> http://www.fonicmonkey.net/
>> http://CambridgeWebHeads.ning.com/
>>
>> <mysql-64bit-monkeypatch.rb>_______________________________________________
>> Facebooker-talk mailing list
>> Facebooker-talk at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/facebooker-talk
>>
>
> _______________________________________________
> Facebooker-talk mailing list
> Facebooker-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/facebooker-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20081111/e0617087/attachment-0001.html>
More information about the Facebooker-talk
mailing list