Need advice on a process

Hi all,

I am making a FB app that has just one page that needs to deal with the
database. The process that i have done of far is:

On post:

Checks if fb user is logged in and app is authorized.
Checks if fb user is already in db.
if they are it updates the information.
else
if not then add record.
else
redirect to /auth/facebook

So the bit i need advice with is that i was thinking the fb callback url
would be ideal to submit the information of:


Checks if fb user is already in db.
if they are it updates the information.
else
if not then add record.

So…

if the user is not logged in, they log in, authorized the app, then
calls the fb callback url,

or

if the user is not logged in, they log in, but app is already
authorized, then calls the fb callback url,

when in both cases it runs:


Checks if fb user is already in db.
if they are it updates the information.
else
if not then add record.

Does this sound ok to do.

Edit: this is for when the submit button is pressed and then it
processes authentication then even if the user is authorized or not
along with the app permissions it will redirect back to the page that it
was submitted from and adds or updates the db.

Thanks

I would look into either Sequel (Ruby only app) or ActiveRecord (if
you’re
doing Rails) to handle the database interaction. This should take a lot
of
the SQL overhead out of the equation. I would almost consider just going
over the Facebook API, or just going over a book like Railsspace if
you’re
considering making your own Social Networking site.

Brandon W.

Brandon W. wrote in post #1076978:

I would look into either Sequel (Ruby only app) or ActiveRecord (if
you’re
doing Rails) to handle the database interaction. This should take a lot
of
the SQL overhead out of the equation. I would almost consider just going
over the Facebook API, or just going over a book like Railsspace if
you’re
considering making your own Social Networking site.

Brandon W.

Hi Brandon,

Thanks for the reply. I have got the db etc sorted, I’m using sinatra,
postgresql and data-mapper. It was just to find out if this sounded OK
as there is only one page that deals with the db so if someone goes to
my fb app and enters the field that is required and they press submit,
it basically check if the fb user is logged in/app authorized then
continue with the process that the user as just done which is submitted
the form, but if they are logged in/app authorized then it just add of
updates the record. Unless there is a way to redirect the user to the
last posted event, so once it has finished authorizing, then it redirect
back to the original post state and processes as normal.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs