开发者

Saving the Comment object after successfull oauth login with Rails' omniauth

I want rails to either update or store the Comment after a user did a successfull loging trough omniauth (Twitter, Facebook or OpenID).

  1. A (not logged in) user fills in开发者_JS百科 a comment form. Posts that.
  2. User gets an omniauth page where she can choose the sign-in-method: Twitter, Facebook or OpenID.
  3. Once the user returns from the oAuth successfully, I want to store (or publish) the Comment.

I have this working, using a session-variable, but that is not very thread-safe: it will break if a user has multiple comment-tabs open with the same session.

Should I save the comment to the database in an unpublished state, and toggle that after returning? And if so, how to know how to toggle te correct comment? Problem is similar to abovementioned session-issue.

Is there some way to simply pass the comment-object along with the omniauth and recieve it back when the user returns from a successfull sign-in?

Or can I pass some hash-string along that I can extract after a successfull return?

Edit: complete rewrite to simplify and clarify the question.


Store post id along with comment text in session. On successful authentication, find the post using stored id and build the comment object for it.

Update - In case authentication fails, delete all such entries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜