Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

David Bayendor's Profile

GitHub User: bayendor

Site: http://bayendor.github.io/

Comments by David Bayendor

Avatar

Dana:

Make sure you have included the code for basic authorization in application_controller.rb

ruby
def authorize
  redirect_to login_url, alert: "Not authorized" if current_user.nil?
end

and then make sure to invoke it in all your controllers:

ruby
class ArticlesController < ApplicationController
  
  before_filter :authorize, only: [:edit, :update]  # could also use before_action in Rails 4