Pinterest invite system with Devise
What is the best practice with Devise 2.1 to build a simple invite system just like Pinterest?
In other words, I would like to allow new users to sign-up with an invitation form. Then, I would like that:
- First, Devise send a "Thanks for Joining the Fuu Waiting List" email.
- To finish, maybe with a cron-task every 3 hours, Devise send a "You've Been Invited to Join Fuu" email.
I'm using Devise 2.1 with confirmable module. I think devise_invitable gem is not useful in my case, because invited user should not be able to invite new user.
I asked a kindoff similar question before maybe it is of any use to you:
Basically what you want to do is store the email of the user in a "requests" model so you get a table where you can store the email and create a field type boolean with processed. This results in:
|email |processed| firstname.lastname@example.org true email@example.com false
Then in /lib/tasks/ create a new rake tasks that loops true all your requests and process them in batches. This is the rough Idea but it should get you started.
Rough idea to get you started: What you basically want is store wich users are signed up true your invitation system. Stackoverflow is not for complete workouts its to get you in the right direction ;) this is to complex to totally write out.
get '/signup/:code' => "devise/registrations#new"
params[:code] unless params[:code] .. check if the code is correct .. render your form here else .. you need an invitation code to join our site end
on_create :set_processed def set_processed .. set processed to true end