sorcery is a authendication library for ruby on rails. sample is here.
sample is here.
It's easy to use following template.
rails new app_name -m https://gist.githubusercontent.com/childbamboo/aa8ceaa31be155b1ab4c/raw/a826fd6a25be70858fe3741895ad2016b89473be/rails_template.rb