0 votes
in Ruby by

There is a bug in this code. The logout message is not appearing on the login template. What is the cause?

class AccessController < ActionController::Base

  def destroy

    session[:admin_id] = nil

    flash[:notice] = ""You have been logged out""

    render('login')

end

 a. The string assigned to flash[:notice] will not be available until the next browser request.

 b. An instance variable should be used for flash[:notice]

 c. This is an invalid syntax to use to assign valuse to flash[:notice]

 d. The previous value of flash[:notice] will not be cleared automatically

1 Answer

0 votes
by
There is a bug in this code. The logout message is not appearing on the login template. What is the cause?

class AccessController < ActionController::Base

  def destroy

    session[:admin_id] = nil

    flash[:notice] = ""You have been logged out""

    render('login')

end

Correct answer is :-  The string assigned to flash[:notice] will not be available until the next browser request.

Related questions

0 votes
asked Sep 3, 2022 in Ruby by DavidAnderson
0 votes
asked Sep 3, 2022 in Ruby by DavidAnderson
...