ruby on rails - How do I force a user to either register or login before their post is saved? -


i have post model, , can create post. before saved, user must logged in.

i using devise. how force them login/register before saved, , complete operation once that?

i thinking of doing before_save on post model. issue approach don't have access current_user object in model.

i unsure how save record, , continue operation once login.

edit 1

another hacky way change f.submit regular button redirects them login page. issue approach doesn't save info , allow them hit "submit" upon successful login. have go through entire post/_form again - trying avoid.

sounds me problems avoided if forbid people access post-creating if aren't logged in. if there no cases user can create post without being logged in, make them log in first. 1 way make link leads post-creating (if there such thing) check if user logged in, , if aren't send them login form.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -