Instead of implementing something like Devise, or your own authentication, you can just use simple http authentication from Ruby on Rails.
Maybe you just need to hide a simple admin section, not ready to show the website to the world, etc. When that's the case, this simple solution is really great.
class Admin::PostsController < ApplicationController
http_basic_authenticate_with name: "codewithstein", password: "rubyonrails"
def index
@posts = Post.order(created_at: :desc)
end
end
So with this one line, you will now need a username and password to access this controller. Note that saving passwords like this in clear text is not so called best practice, so keep that in mind.