update check user

This commit is contained in:
Aung Myo
2018-03-22 12:42:17 +06:30
parent fbbe2c0ab9
commit 75a3576a77
10 changed files with 74 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
class Transactions::CreditNotesController < ApplicationController
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
before_action :check_user
# GET /transactions/sales
# GET /transactions/sales.json
@@ -25,12 +26,18 @@ class Transactions::CreditNotesController < ApplicationController
@credit_notes = 0
end
end
puts "sssssssssssss"
puts @credit_notes.to_json
respond_to do |format|
format.html # index.html.erb
format.json { render json: @credit_notes }
end
end
end
end
def check_user
if current_user.nil?
redirect_to root_path
end
end
end

View File

@@ -1,5 +1,7 @@
class Transactions::OrdersController < ApplicationController
load_and_authorize_resource except: [:create]
before_action :check_user
def index
filter = params[:filter]
@@ -39,4 +41,10 @@ class Transactions::OrdersController < ApplicationController
end
end
def check_user
if current_user.nil?
redirect_to root_path
end
end
end

View File

@@ -1,6 +1,7 @@
class Transactions::SalesController < ApplicationController
load_and_authorize_resource except: [:create]
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
before_action :check_user
# GET /transactions/sales
# GET /transactions/sales.json
@@ -129,6 +130,12 @@ class Transactions::SalesController < ApplicationController
end
end
def check_user
if current_user.nil?
redirect_to root_path
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_transactions_sale

View File

@@ -1,6 +1,7 @@
class Transactions::ShiftSalesController < ApplicationController
load_and_authorize_resource except: [:create]
before_action :set_transactions_shift_sale, only: [:show, :edit, :update, :destroy]
before_action :check_user
def index
@@ -53,6 +54,12 @@ class Transactions::ShiftSalesController < ApplicationController
end
end
def check_user
if current_user.nil?
redirect_to root_path
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_transactions_shift_sale