This seems to keep coming up for me on various projects and I'm wondering if anyone out there has a great solution:
We have a Rails app with Authlogic authentication. Initially, there's a nice, clean, RESTful ListingsController that requires a user to be logged in before they can post/create:
before_filter :require_user, :only => [ :new, :create]
However, after seeing this in action we decide we need to try out a different flow where unregistered users can fill out the form for the Listing first and then be prompted to register/login. If they abandon registration, we don't need to create the Listing. If they authenticate, we want to wire up the Listing with the current_user as we would normally.
A couple possible snags:
- The new Listing form allows users to upload files that we store with Paperclip.
- Authentication may happen through a series of redirects for facebook or twitter.
I feel like this authenticate post-creation scenario is a common enough that there would be some resources on standard methods for attacking it, but I haven't really found much. Anyone have a good solution or resource for this?
Thanks!