Sha256: 13d28e8fa36eb571531a09f8efef81e92626f97aa65923970b43140b783c91ef

Contents?: true

Size: 397 Bytes

Versions: 35

Compression:

Stored size: 397 Bytes

Contents

class ApplicationController < ActionController::Base
  
  protect_from_forgery
  
  helper_method :current_user
  
  def current_user
    # session[:user_id] = User.first.id
    @current_user ||= User.find_by_id(session[:user_id])
  end
  
  def login_required
    unless current_user
      flash[:warn] = "You must be logged in to view that page!"
      redirect_to root_url
    end
  end
  
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
blogit-1.1.2 spec/dummy/app/controllers/application_controller.rb
blogit-1.1.1 spec/dummy/app/controllers/application_controller.rb
blogit-1.1.0 spec/dummy/app/controllers/application_controller.rb
blogit-1.0.0 spec/dummy/app/controllers/application_controller.rb
blogit-1.0.0.rc1 spec/dummy/app/controllers/application_controller.rb
blogit-0.8.0 spec/dummy/app/controllers/application_controller.rb
blogit-0.7.0 spec/dummy/app/controllers/application_controller.rb
blogit-0.6.0 spec/dummy/app/controllers/application_controller.rb
blogit-0.5.1 spec/dummy/app/controllers/application_controller.rb
blogit-0.5.0 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.8 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.7 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.6 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.5 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.4 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.3 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.2 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.1 spec/dummy/app/controllers/application_controller.rb
blogit-0.4.0 spec/dummy/app/controllers/application_controller.rb
blogit-0.3.2 spec/dummy/app/controllers/application_controller.rb