module ChangeNetwork
  extend ActiveSupport::Concern

  included do
	  def change_user_network
	    network = current_user.location_networks.find_by_id(params[:id])
	    unless network.present?
	      network = current_user.location_networks.first
	      flash[:notice] = "Your network has been changed to #{network.network_name}"
	    end
	    current_user.current_network = network.id
	    @current_network = current_user.current_network
	    logger.info("Current Network in show <<<<<<#{@current_network.id}") unless @current_network.blank?
	    redirect_to request.referer || root_path
	  end
	end
end