Skip to content

carldaws/early_bird

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EarlyBird

A very simple Gem to add waitlist functionality to a WIP Rails app.

Future Features

I plan to add automated invite codes in the near future

Usage

Follow the installation instructions and you're good to go!

Installation

Add this line to your application's Gemfile:

gem "early_bird"

And then execute:

$ bundle

Or install it yourself as:

$ gem install early_bird

Then install the migrations:

$ bin/rails early_bird:install:migrations

And migrate the database:

$ bin/rails db:migrate

EarlyBird requires new and show views to be implemented in your app:

# app/views/early_bird/submissions/new.html.erb
<%= form_with(model: @submission) do |form| %>
  <%= form.email_field :email, placeholder: "Your email" %>
  <%= form.submit "Join the Waitlist" %>
<% end %>
# app/views/early_bird/submissions/show.html.erb
<p>Thank you! <%= @submission.email %> has been added to the waitlist!</p>

Then mount the engine in your routes.rb file:

mount EarlyBird::Engine => "/"

In your application_controller.rb file, define an authenticate_user! method, which EarlyBird skips (to allow access to the waitlist while preventing access to the rest of the app):

class ApplicationController < ActionController::Base
  before_action :authenticate_user!

  private 

  def authenticate_user!
    http_basic_authenticate_with name: "dev", password: "secret"
  end
end

Contributing

Contributions welcome

License

The gem is available as open source under the terms of the MIT License.

About

Add a simple waitlist to your WIP Rails apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published