Authentication and authorization is based on code for a beginner level tutorial using Ruby 2.2, Rails 4.2 and two popular Ruby gems: Devise and cancancan.
The tutorial can be found here: hibbard.eu/authentication-with-devise-and-cancancan-in-rails-4-2