Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails rails admin secure page

config.authorize_with do |controller|
  if current_user.nil?
    redirect_to main_app.new_account_session_path, flash: {error: 'Please Login to Continue..'}
  elsif !current_user.admin?
    redirect_to main_app.root_path, flash: {error: 'You are not Admin bro!'}
  end
end
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rails #rails #admin #secure #page
ADD COMMENT
Topic
Name
7+8 =