mirror of
https://github.com/iritmaximus/brewery.git
synced 2026-10-12 19:13:49 +03:00
4.15 added better login checking
This commit is contained in:
@@ -5,4 +5,8 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
User.find_by_id session[:user_id]
|
||||
end
|
||||
|
||||
def ensure_that_signed_in
|
||||
redirect_to signin_path, notice: 'you should be signed in' if current_user.nil?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class BeerclubsController < ApplicationController
|
||||
before_action :set_beerclub, only: %i[show edit update destroy]
|
||||
before_action :ensure_that_signed_in, except: [:index, :show]
|
||||
|
||||
# GET /beerclubs or /beerclubs.json
|
||||
def index
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class BeersController < ApplicationController
|
||||
before_action :set_beer, only: %i[show edit update destroy]
|
||||
before_action :set_breweries_and_styles_for_template, only: [:new, :edit, :create]
|
||||
before_action :ensure_that_signed_in, except: [:index, :show]
|
||||
|
||||
# GET /beers or /beers.json
|
||||
def index
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class BreweriesController < ApplicationController
|
||||
before_action :set_brewery, only: %i[show edit update destroy]
|
||||
before_action :authenticate, only: [:destroy]
|
||||
before_action :ensure_that_signed_in, except: [:index, :show]
|
||||
|
||||
# GET /breweries or /breweries.json
|
||||
def index
|
||||
|
||||
Reference in New Issue
Block a user