Skip to content

Instantly share code, notes, and snippets.

@johno
Last active October 11, 2017 18:31
Show Gist options
  • Save johno/a0526adaf84714ad3ce65f76aaa024a1 to your computer and use it in GitHub Desktop.
Save johno/a0526adaf84714ad3ce65f76aaa024a1 to your computer and use it in GitHub Desktop.
Login link flow with Rails, Clearance, and has_secure_token
class SessionToken < ApplicationRecord
has_secure_token
belongs_to :user
end
class User < ApplicationRecord
include Clearance::User
has_many :login_links
has_many :session_tokens
validates :email, email_format: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment